# HG changeset patch # User Chong Yidong # Date 1268668308 14400 # Node ID 3c55036637eceb34dd8010b8a40303fb58026f89 # Parent 82e44180c8a6c3cfcc37a5a89faae067789efad6 Fix bug in `format' (Bug#5710). * editfns.c (Fformat): Account for string precision when computing field width (Bug#5710). diff -r 82e44180c8a6 -r 3c55036637ec src/ChangeLog --- a/src/ChangeLog Mon Mar 15 11:45:03 2010 +0100 +++ b/src/ChangeLog Mon Mar 15 11:51:48 2010 -0400 @@ -1,3 +1,8 @@ +2010-03-15 Andreas Politz (tiny change) + + * editfns.c (Fformat): Account for string precision when computing + field width (Bug#5710). + 2010-03-05 Stefan Monnier Make it possible to C-g in a tight bytecode loop again (bug#5680). diff -r 82e44180c8a6 -r 3c55036637ec src/editfns.c --- a/src/editfns.c Mon Mar 15 11:45:03 2010 +0100 +++ b/src/editfns.c Mon Mar 15 11:51:48 2010 -0400 @@ -3782,7 +3782,11 @@ 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')