diff options
Diffstat (limited to 'src/editfns.c')
| -rw-r--r-- | src/editfns.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/editfns.c b/src/editfns.c index 0fbc5aad8c3..a4cff595bd0 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -4268,6 +4268,9 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message) | |||
| 4268 | /* The start and end bytepos in the output string. */ | 4268 | /* The start and end bytepos in the output string. */ |
| 4269 | ptrdiff_t start, end; | 4269 | ptrdiff_t start, end; |
| 4270 | 4270 | ||
| 4271 | /* The start of the spec in the format string. */ | ||
| 4272 | ptrdiff_t fbeg; | ||
| 4273 | |||
| 4271 | /* Whether the argument is a string with intervals. */ | 4274 | /* Whether the argument is a string with intervals. */ |
| 4272 | bool_bf intervals : 1; | 4275 | bool_bf intervals : 1; |
| 4273 | } *info; | 4276 | } *info; |
| @@ -4421,6 +4424,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message) | |||
| 4421 | char conversion = *format++; | 4424 | char conversion = *format++; |
| 4422 | memset (&discarded[format0 - format_start], 1, | 4425 | memset (&discarded[format0 - format_start], 1, |
| 4423 | format - format0 - (conversion == '%')); | 4426 | format - format0 - (conversion == '%')); |
| 4427 | info[ispec].fbeg = format0 - format_start; | ||
| 4424 | if (conversion == '%') | 4428 | if (conversion == '%') |
| 4425 | { | 4429 | { |
| 4426 | new_result = true; | 4430 | new_result = true; |
| @@ -5011,7 +5015,9 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message) | |||
| 5011 | else if (discarded[bytepos] == 1) | 5015 | else if (discarded[bytepos] == 1) |
| 5012 | { | 5016 | { |
| 5013 | position++; | 5017 | position++; |
| 5014 | if (fieldn < nspec && translated == info[fieldn].start) | 5018 | if (fieldn < nspec |
| 5019 | && position > info[fieldn].fbeg | ||
| 5020 | && translated == info[fieldn].start) | ||
| 5015 | { | 5021 | { |
| 5016 | translated += info[fieldn].end - info[fieldn].start; | 5022 | translated += info[fieldn].end - info[fieldn].start; |
| 5017 | fieldn++; | 5023 | fieldn++; |
| @@ -5031,7 +5037,9 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message) | |||
| 5031 | else if (discarded[bytepos] == 1) | 5037 | else if (discarded[bytepos] == 1) |
| 5032 | { | 5038 | { |
| 5033 | position++; | 5039 | position++; |
| 5034 | if (fieldn < nspec && translated == info[fieldn].start) | 5040 | if (fieldn < nspec |
| 5041 | && position > info[fieldn].fbeg | ||
| 5042 | && translated == info[fieldn].start) | ||
| 5035 | { | 5043 | { |
| 5036 | translated += info[fieldn].end - info[fieldn].start; | 5044 | translated += info[fieldn].end - info[fieldn].start; |
| 5037 | fieldn++; | 5045 | fieldn++; |