aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman2002-01-02 19:57:07 +0000
committerRichard M. Stallman2002-01-02 19:57:07 +0000
commit308dd672ad0a61b871368d01b2d14f7d7f03b4c6 (patch)
tree697a36e41a2795723d552e53ae3c9c532689f4eb /src
parent7bc6015401026a60658819b4ebc2628681ad71e9 (diff)
downloademacs-308dd672ad0a61b871368d01b2d14f7d7f03b4c6.tar.gz
emacs-308dd672ad0a61b871368d01b2d14f7d7f03b4c6.zip
(Fformat): Update thissize from field_width
based on the actual width, in the string case.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/editfns.c4
2 files changed, 8 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index a319234b1cf..e0ffe90c594 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12002-01-02 Richard M. Stallman <rms@gnu.org>
2
3 * editfns.c (Fformat): Update thissize from field_width
4 based on the actual width, in the string case.
5
12002-01-01 Pavel Jan,Bm(Bk <Pavel@Janik.cz> 62002-01-01 Pavel Jan,Bm(Bk <Pavel@Janik.cz>
2 7
3 * charset.h (UNIBYTE_STR_AS_MULTIBYTE_P): Parenthesize assignment 8 * 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) */)
3217 if (*format++ == '%') 3217 if (*format++ == '%')
3218 { 3218 {
3219 int thissize = 0; 3219 int thissize = 0;
3220 int actual_width = 0;
3220 unsigned char *this_format_start = format - 1; 3221 unsigned char *this_format_start = format - 1;
3221 int field_width, precision; 3222 int field_width, precision;
3222 3223
@@ -3297,6 +3298,7 @@ usage: (format STRING &rest OBJECTS) */)
3297 if (*format != 's' && *format != 'S') 3298 if (*format != 's' && *format != 'S')
3298 error ("Format specifier doesn't match argument type"); 3299 error ("Format specifier doesn't match argument type");
3299 thissize = CONVERTED_BYTE_SIZE (multibyte, args[n]); 3300 thissize = CONVERTED_BYTE_SIZE (multibyte, args[n]);
3301 actual_width = lisp_string_width (args[n], -1, NULL, NULL);
3300 } 3302 }
3301 /* Would get MPV otherwise, since Lisp_Int's `point' to low memory. */ 3303 /* Would get MPV otherwise, since Lisp_Int's `point' to low memory. */
3302 else if (INTEGERP (args[n]) && *format != 's') 3304 else if (INTEGERP (args[n]) && *format != 's')
@@ -3350,7 +3352,7 @@ usage: (format STRING &rest OBJECTS) */)
3350 goto string; 3352 goto string;
3351 } 3353 }
3352 3354
3353 thissize = max (field_width, thissize); 3355 thissize += max (0, field_width - actual_width);
3354 total += thissize + 4; 3356 total += thissize + 4;
3355 } 3357 }
3356 3358