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:
parent
96be6b6eb9
commit
71c92d8913
2 changed files with 25 additions and 3 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue