1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-04-27 16:51:06 -07:00

Fix copying text properties by 'format'

* src/editfns.c (styled_format): Add the spec beginning index
to the info recorded for each format spec, and use it to
detect the case that a format spec and its text property end
where the next spec with another property begins.  (Bug#32404)

* test/src/editfns-tests.el (format-properties): Add tests for
bug#32404.
This commit is contained in:
Eli Zaretskii 2018-08-09 18:08:35 +03:00
parent 96be6b6eb9
commit 71c92d8913
2 changed files with 25 additions and 3 deletions

View file

@ -88,7 +88,21 @@
(format "%-10s" (concat (propertize "01" 'face 'bold)
(propertize "23" 'face 'underline)
(propertize "45" 'face 'italic)))
#("012345 " 0 2 (face bold) 2 4 (face underline) 4 10 (face italic)))))
#("012345 "
0 2 (face bold) 2 4 (face underline) 4 10 (face italic))))
;; Bug #32404
(should (ert-equal-including-properties
(format (concat (propertize "%s" 'face 'bold)
""
(propertize "%s" 'face 'error))
"foo" "bar")
#("foobar" 0 3 (face bold) 3 6 (face error))))
(should (ert-equal-including-properties
(format (concat "%s" (propertize "%s" 'face 'error)) "foo" "bar")
#("foobar" 3 6 (face error))))
(should (ert-equal-including-properties
(format (concat "%s " (propertize "%s" 'face 'error)) "foo" "bar")
#("foo bar" 4 7 (face error)))))
;; Tests for bug#5131.
(defun transpose-test-reverse-word (start end)