summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenichi Handa <handa@m17n.org>2003-01-20 00:23:25 +0000
committerKenichi Handa <handa@m17n.org>2003-01-20 00:23:25 +0000
commite5c1a52a2e8b1e87b91d12b4825a31511abfcb0f (patch)
treef1e09814b2d4fd168b67f58cf3c213bc72bbc118
parent599ac874b534db57a485d42d248dc2c0e46ac50e (diff)
downloademacs-e5c1a52a2e8b1e87b91d12b4825a31511abfcb0f.tar.gz
(Fformat): Update thissize from field_width based on
the actual width, in the string case (back-porting of the 2002-01-02 change in HEAD).
-rw-r--r--src/ChangeLog6
-rw-r--r--src/editfns.c4
2 files changed, 9 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 75a8fb88bff..1b304d31566 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
+2003-01-20 Kenichi Handa <handa@m17n.org>
+
+ * editfns.c (Fformat): Update thissize from field_width based on
+ the actual width, in the string case (back-porting of the
+ 2002-01-02 change in HEAD).
+
2003-01-17 Francesco Potort,Al(B <pot@gnu.org>
* Version 21.3 released.
diff --git a/src/editfns.c b/src/editfns.c
index afc84658bb2..76a732d1ef8 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -3169,6 +3169,7 @@ Use %% to put a single % into the output.")
if (*format++ == '%')
{
int thissize = 0;
+ int actual_width = 0;
unsigned char *this_format_start = format - 1;
int field_width, precision;
@@ -3249,6 +3250,7 @@ Use %% to put a single % into the output.")
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')
@@ -3302,7 +3304,7 @@ Use %% to put a single % into the output.")
goto string;
}
- thissize = max (field_width, thissize);
+ thissize += max (0, field_width - actual_width);
total += thissize + 4;
}