aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChong Yidong <[email protected]>2010-03-15 11:51:48 -0400
committerChong Yidong <[email protected]>2010-03-15 11:51:48 -0400
commit35cd7cd68e92e4f364bde2875a02780f2caf6197 (patch)
tree1d29a87cd1a2d5b66bcb151129055af9c200b413 /src
parent3af45ae1a659c88e12db23c739ea4bd353674b91 (diff)
Fix bug in `format' (Bug#5710).
* editfns.c (Fformat): Account for string precision when computing field width (Bug#5710).
Diffstat (limited to 'src')
-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 ce4fe1cd7b..d8369bb9a2 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2010-03-15 Andreas Politz <[email protected]> (tiny change)
+
+ * editfns.c (Fformat): Account for string precision when computing
+ field width (Bug#5710).
+
2010-03-05 Stefan Monnier <[email protected]>
Make it possible to C-g in a tight bytecode loop again (bug#5680).
diff --git a/src/editfns.c b/src/editfns.c
index 093f141bff..9f30ea0641 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -3782,7 +3782,11 @@ usage: (format STRING &rest OBJECTS) */)
to be as large as is calculated here. Easy check for
the case PRECISION = 0. */
thissize = precision[n] ? CONVERTED_BYTE_SIZE (multibyte, args[n]) : 0;
+ /* The precision also constrains how much of the argument
+ string will finally appear (Bug#5710). */
actual_width = lisp_string_width (args[n], -1, NULL, NULL);
+ if (precision[n] != -1)
+ actual_width = min(actual_width,precision[n]);
}
/* Would get MPV otherwise, since Lisp_Int's `point' to low memory. */
else if (INTEGERP (args[n]) && *format != 's')