aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2010-03-13 14:54:29 -0500
committerChong Yidong2010-03-13 14:54:29 -0500
commitcef3058fee82cbd5b7dc3112250f4735c76f8fbf (patch)
treebb928918d082470c22b05f6a65a0783871c32a14
parent073589f4b1ee51b44d9c9833d3b8e5fad40510f0 (diff)
downloademacs-cef3058fee82cbd5b7dc3112250f4735c76f8fbf.tar.gz
emacs-cef3058fee82cbd5b7dc3112250f4735c76f8fbf.zip
Fix bug in `format' (Bug#5710).
* editfns.c (Fformat): Account for string precision when computing field width (Bug#5710).
-rw-r--r--src/ChangeLog5
-rw-r--r--src/editfns.c4
2 files changed, 9 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 37a4cdb1b10..da4e336b0ae 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12010-03-13 Andreas Politz <politza@fh-trier.de> (tiny change)
2
3 * editfns.c (Fformat): Account for string precision when computing
4 field width (Bug#5710).
5
12010-03-12 Chong Yidong <cyd@stupidchicken.com> 62010-03-12 Chong Yidong <cyd@stupidchicken.com>
2 7
3 * xfns.c (Fx_create_frame): Set default to Qright. 8 * xfns.c (Fx_create_frame): Set default to Qright.
diff --git a/src/editfns.c b/src/editfns.c
index 093f141bff2..9f30ea06411 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -3782,7 +3782,11 @@ usage: (format STRING &rest OBJECTS) */)
3782 to be as large as is calculated here. Easy check for 3782 to be as large as is calculated here. Easy check for
3783 the case PRECISION = 0. */ 3783 the case PRECISION = 0. */
3784 thissize = precision[n] ? CONVERTED_BYTE_SIZE (multibyte, args[n]) : 0; 3784 thissize = precision[n] ? CONVERTED_BYTE_SIZE (multibyte, args[n]) : 0;
3785 /* The precision also constrains how much of the argument
3786 string will finally appear (Bug#5710). */
3785 actual_width = lisp_string_width (args[n], -1, NULL, NULL); 3787 actual_width = lisp_string_width (args[n], -1, NULL, NULL);
3788 if (precision[n] != -1)
3789 actual_width = min(actual_width,precision[n]);
3786 } 3790 }
3787 /* Would get MPV otherwise, since Lisp_Int's `point' to low memory. */ 3791 /* Would get MPV otherwise, since Lisp_Int's `point' to low memory. */
3788 else if (INTEGERP (args[n]) && *format != 's') 3792 else if (INTEGERP (args[n]) && *format != 's')