mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-06-14 04:21:24 +00:00
Fix off-by-one error in 'styled_format'
This would (rarely) result in composition properties being shared across the concatenation of two copies of a string. * src/editfns.c (styled_format): Include the first argument in the range. * test/src/editfns-tests.el (editfns-tests--format-composition-property): New.
This commit is contained in:
parent
6932c940fd
commit
c146e3643c
2 changed files with 10 additions and 1 deletions
|
|
@ -4398,7 +4398,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message)
|
|||
props = extend_property_ranges (props, len, new_len);
|
||||
/* If successive arguments have properties, be sure that
|
||||
the value of `composition' property be the copy. */
|
||||
if (1 < i && info[i - 1].end)
|
||||
if (1 <= i && info[i - 1].end)
|
||||
make_composition_value_copy (props);
|
||||
add_text_properties_from_list (val, props,
|
||||
make_fixnum (info[i].start));
|
||||
|
|
|
|||
|
|
@ -938,4 +938,13 @@ sufficiently large to avoid truncation."
|
|||
(pos-bol 2) (pos-eol 2))
|
||||
(should (equal (buffer-string) "toto\nEmacs forever!\n"))))
|
||||
|
||||
(ert-deftest editfns-tests--format-composition-property ()
|
||||
"Check that composition properties are un-identified by `format'."
|
||||
(let* ((s (compose-chars ?a ?b ?c))
|
||||
(str (format "%s%s%s" s s s)))
|
||||
(should-not (eq (get-text-property 0 'composition str)
|
||||
(get-text-property 3 'composition str)))
|
||||
(should-not (eq (get-text-property 3 'composition str)
|
||||
(get-text-property 6 'composition str)))))
|
||||
|
||||
;;; editfns-tests.el ends here
|
||||
|
|
|
|||
Loading…
Reference in a new issue