diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2019-11-14 14:42:39 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2019-11-14 14:44:42 -0800 |
commit | c2cd8e6265b78a5f0be3335ea6d8868e80814db0 (patch) | |
tree | 0934435db848e080e14d46fa823456145616506b /src/editfns.c | |
parent | 2241f7ca7adb8aa7d785174dec0280a07cd16479 (diff) | |
download | emacs-c2cd8e6265b78a5f0be3335ea6d8868e80814db0.tar.gz emacs-c2cd8e6265b78a5f0be3335ea6d8868e80814db0.tar.bz2 emacs-c2cd8e6265b78a5f0be3335ea6d8868e80814db0.zip |
Fix byte-counting error in ‘format’
Problem reported by Paul Pogonyshev (Bug#38191).
* src/editfns.c (styled_format): When checking for adjacent
%-sequences, use byte position rather than character position.
* test/src/editfns-tests.el (format-properties): Test for fix.
Diffstat (limited to 'src/editfns.c')
-rw-r--r-- | src/editfns.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/editfns.c b/src/editfns.c index 1b33f397110..8fc866d391f 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -3143,7 +3143,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message) /* The start and end bytepos in the output string. */ ptrdiff_t start, end; - /* The start of the spec in the format string. */ + /* The start bytepos of the spec in the format string. */ ptrdiff_t fbeg; /* Whether the argument is a string with intervals. */ @@ -3954,7 +3954,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message) { position++; if (fieldn < nspec - && position > info[fieldn].fbeg + && bytepos >= info[fieldn].fbeg && translated == info[fieldn].start) { translated += info[fieldn].end - info[fieldn].start; @@ -3976,7 +3976,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message) { position++; if (fieldn < nspec - && position > info[fieldn].fbeg + && bytepos >= info[fieldn].fbeg && translated == info[fieldn].start) { translated += info[fieldn].end - info[fieldn].start; |