changeset 42484:717eee813b2c

(Fformat): Update thissize from field_width based on the actual width, in the string case.
author Richard M. Stallman <rms@gnu.org>
date Wed, 02 Jan 2002 19:56:50 +0000
parents 52015642068d
children 642ac10e7a4b
files src/editfns.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/editfns.c	Wed Jan 02 13:46:25 2002 +0000
+++ b/src/editfns.c	Wed Jan 02 19:56:50 2002 +0000
@@ -3217,6 +3217,7 @@
     if (*format++ == '%')
       {
 	int thissize = 0;
+	int actual_width = 0;
 	unsigned char *this_format_start = format - 1;
 	int field_width, precision;
 
@@ -3297,6 +3298,7 @@
 	    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 @@
 	    goto string;
 	  }
 
-	thissize = max (field_width, thissize);
+	thissize += max (0, field_width - actual_width);
 	total += thissize + 4;
       }