summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2018-08-09 18:08:35 +0300
committerEli Zaretskii <eliz@gnu.org>2018-08-09 18:08:35 +0300
commit71c92d89137b7fdde6c2bd4bed9b8dfda5fa53dd (patch)
treecbeb28b0a8287a43796cdaaf9ad806446d22d88a /test
parent96be6b6eb99ae1d77702932c97e8b3a147c6265a (diff)
downloademacs-71c92d89137b7fdde6c2bd4bed9b8dfda5fa53dd.tar.gz
emacs-71c92d89137b7fdde6c2bd4bed9b8dfda5fa53dd.tar.bz2
emacs-71c92d89137b7fdde6c2bd4bed9b8dfda5fa53dd.zip
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.
Diffstat (limited to 'test')
-rw-r--r--test/src/editfns-tests.el16
1 files changed, 15 insertions, 1 deletions
diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el
index ec411ff773b..c2ec99d8032 100644
--- a/test/src/editfns-tests.el
+++ b/test/src/editfns-tests.el
@@ -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)