From: Richard M. Stallman Date: Wed, 2 Jan 2002 19:57:07 +0000 (+0000) Subject: (Fformat): Update thissize from field_width X-Git-Tag: ttn-vms-21-2-B4~17355 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=308dd672ad0a61b871368d01b2d14f7d7f03b4c6;p=emacs.git (Fformat): Update thissize from field_width based on the actual width, in the string case. --- diff --git a/src/ChangeLog b/src/ChangeLog index a319234b1cf..e0ffe90c594 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2002-01-02 Richard M. Stallman + + * editfns.c (Fformat): Update thissize from field_width + based on the actual width, in the string case. + 2002-01-01 Pavel Jan,Bm(Bk * charset.h (UNIBYTE_STR_AS_MULTIBYTE_P): Parenthesize assignment diff --git a/src/editfns.c b/src/editfns.c index 9c118cc67b1..fac0db045eb 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -3217,6 +3217,7 @@ usage: (format STRING &rest OBJECTS) */) if (*format++ == '%') { int thissize = 0; + int actual_width = 0; unsigned char *this_format_start = format - 1; int field_width, precision; @@ -3297,6 +3298,7 @@ usage: (format STRING &rest OBJECTS) */) if (*format != 's' && *format != 'S') error ("Format specifier doesn't match argument type"); thissize = CONVERTED_BYTE_SIZE (multibyte, args[n]); + actual_width = lisp_string_width (args[n], -1, NULL, NULL); } /* Would get MPV otherwise, since Lisp_Int's `point' to low memory. */ else if (INTEGERP (args[n]) && *format != 's') @@ -3350,7 +3352,7 @@ usage: (format STRING &rest OBJECTS) */) goto string; } - thissize = max (field_width, thissize); + thissize += max (0, field_width - actual_width); total += thissize + 4; }