diff options
author | Eli Zaretskii <eliz@gnu.org> | 2021-02-06 11:54:08 +0200 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2021-02-06 11:54:08 +0200 |
commit | b84b8dff709fd80ee124565222f333f53351ab4a (patch) | |
tree | 19eb4e29ca739b28e0e12e1e5c4b9a3cf8cd26c8 /test/src | |
parent | 431b098a206d27a2dff6a88312c28c36926f90e9 (diff) | |
download | emacs-b84b8dff709fd80ee124565222f333f53351ab4a.tar.gz emacs-b84b8dff709fd80ee124565222f333f53351ab4a.tar.bz2 emacs-b84b8dff709fd80ee124565222f333f53351ab4a.zip |
Fix copying text properties in 'format'
* src/editfns.c (styled_format): Fix accounting for text
properties that come from the format string. (Bug#46317)
* test/src/editfns-tests.el (format-properties): Add new tests for
bug#46317.
Diffstat (limited to 'test/src')
-rw-r--r-- | test/src/editfns-tests.el | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el index 64f9137865b..dcec971c12e 100644 --- a/test/src/editfns-tests.el +++ b/test/src/editfns-tests.el @@ -106,7 +106,27 @@ #("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))))) + #("foo bar" 4 7 (face error)))) + ;; Bug #46317 + (let ((s (propertize "X" 'prop "val"))) + (should (ert-equal-including-properties + (format (concat "%3s/" s) 12) + #(" 12/X" 4 5 (prop "val")))) + (should (ert-equal-including-properties + (format (concat "%3S/" s) 12) + #(" 12/X" 4 5 (prop "val")))) + (should (ert-equal-including-properties + (format (concat "%3d/" s) 12) + #(" 12/X" 4 5 (prop "val")))) + (should (ert-equal-including-properties + (format (concat "%-3s/" s) 12) + #("12 /X" 4 5 (prop "val")))) + (should (ert-equal-including-properties + (format (concat "%-3S/" s) 12) + #("12 /X" 4 5 (prop "val")))) + (should (ert-equal-including-properties + (format (concat "%-3d/" s) 12) + #("12 /X" 4 5 (prop "val")))))) ;; Tests for bug#5131. (defun transpose-test-reverse-word (start end) |