aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/editfns.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/editfns.c b/src/editfns.c
index e3285494c14..991f79abac7 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -3134,6 +3134,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message)
3134 char *format_start = SSDATA (args[0]); 3134 char *format_start = SSDATA (args[0]);
3135 bool multibyte_format = STRING_MULTIBYTE (args[0]); 3135 bool multibyte_format = STRING_MULTIBYTE (args[0]);
3136 ptrdiff_t formatlen = SBYTES (args[0]); 3136 ptrdiff_t formatlen = SBYTES (args[0]);
3137 bool fmt_props = string_intervals (args[0]);
3137 3138
3138 /* Upper bound on number of format specs. Each uses at least 2 chars. */ 3139 /* Upper bound on number of format specs. Each uses at least 2 chars. */
3139 ptrdiff_t nspec_bound = SCHARS (args[0]) >> 1; 3140 ptrdiff_t nspec_bound = SCHARS (args[0]) >> 1;
@@ -3406,13 +3407,20 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message)
3406 convbytes += padding; 3407 convbytes += padding;
3407 if (convbytes <= buf + bufsize - p) 3408 if (convbytes <= buf + bufsize - p)
3408 { 3409 {
3410 /* If the format spec has properties, we should account
3411 for the padding on the left in the info[] array. */
3412 if (fmt_props)
3413 spec->start = nchars;
3409 if (! minus_flag) 3414 if (! minus_flag)
3410 { 3415 {
3411 memset (p, ' ', padding); 3416 memset (p, ' ', padding);
3412 p += padding; 3417 p += padding;
3413 nchars += padding; 3418 nchars += padding;
3414 } 3419 }
3415 spec->start = nchars; 3420 /* If the properties will come from the argument, we
3421 don't extend them to the left due to padding. */
3422 if (!fmt_props)
3423 spec->start = nchars;
3416 3424
3417 if (p > buf 3425 if (p > buf
3418 && multibyte 3426 && multibyte