summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/editfns.c6
-rw-r--r--test/src/editfns-tests.el4
2 files changed, 7 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;
diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el
index a1060808f66..238fb409f0b 100644
--- a/test/src/editfns-tests.el
+++ b/test/src/editfns-tests.el
@@ -90,6 +90,10 @@
(propertize "45" 'face 'italic)))
#("012345 "
0 2 (face bold) 2 4 (face underline) 4 10 (face italic))))
+ ;; Bug #38191
+ (should (ert-equal-including-properties
+ (format (propertize "‘foo’ %s bar" 'face 'bold) "xxx")
+ #("‘foo’ xxx bar" 0 13 (face bold))))
;; Bug #32404
(should (ert-equal-including-properties
(format (concat (propertize "%s" 'face 'bold)