From 326e5855bc8dd3d0c5b2c0e461c65879d2b5694d Mon Sep 17 00:00:00 2001 From: Pádraig Brady Date: Wed, 9 Jan 2013 12:23:35 +0000 Subject: seq: fix misaligment with -w when no precision for start value * src/seq.c (get_default_format): Also account for the case where '.' is auto added to the start value, which is significant when the number sequence narrows. * tests/misc/seq.pl: Add two new tests for the failing cases. * NEWS: Mention the fix. Fixes http://bugs.gnu.org/13394 --- src/seq.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/seq.c b/src/seq.c index 22e5ec5da..5ad5fad94 100644 --- a/src/seq.c +++ b/src/seq.c @@ -336,6 +336,8 @@ get_default_format (operand first, operand step, operand last) last_width--; /* don't include space for '.' */ if (last.precision == 0 && prec) last_width++; /* include space for '.' */ + if (first.precision == 0 && prec) + first_width++; /* include space for '.' */ size_t width = MAX (first_width, last_width); if (width <= INT_MAX) { -- cgit v1.2.3-54-g00ecf