mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 06:20:55 -08:00
Clean up text properties in 'visual-wrap-prefix-mode'
Before refontifying a region, remove any text properties we care about so that we don't end up with stray properties. Additionally, make sure to remove all the properties when deactivating the mode. * lisp/emacs-lisp/subr-x.el (add-remove--display-text-property): New function, extracted from... (add-display-text-property): ... here. (remove-display-text-property): New function. * lisp/visual-wrap.el (visual-wrap--remove-properties): New function... (visual-wrap-prefix-function, visual-wrap-prefix-mode): ... call it. * test/lisp/emacs-lisp/subr-x-tests.el (subr-x-test-remove-display-text-property): New test. * test/lisp/visual-wrap-tests.el (visual-wrap-tests/wrap-prefix-stickiness, visual-wrap-tests/cleanup): New tests. * doc/lispref/display.texi (Display Property): Document 'remove-display-text-property'. * etc/NEWS: Announce 'remove-display-text-property' (bug#76018).
This commit is contained in:
parent
24e6cd4233
commit
90c0c9a01e
6 changed files with 174 additions and 23 deletions
|
|
@ -740,6 +740,44 @@
|
|||
4 8 (display ((raise 0.5) (height 2.0)))
|
||||
8 12 (display (raise 0.5)))))))
|
||||
|
||||
(ert-deftest subr-x-test-remove-display-text-property ()
|
||||
(with-temp-buffer
|
||||
(insert "Foo bar zot gazonk")
|
||||
(add-display-text-property 4 12 'height 2.0)
|
||||
(add-display-text-property 2 8 'raise 0.5)
|
||||
(remove-display-text-property 6 10 'height)
|
||||
(should (equal-including-properties
|
||||
(buffer-string)
|
||||
#("Foo bar zot gazonk"
|
||||
1 3 (display (raise 0.5))
|
||||
3 5 (display ((raise 0.5) (height 2.0)))
|
||||
5 7 (display ((raise 0.5)))
|
||||
9 11 (display (height 2.0))))))
|
||||
(with-temp-buffer
|
||||
(insert "Foo bar zot gazonk")
|
||||
(put-text-property 4 12 'display [(height 2.0)])
|
||||
(add-display-text-property 2 8 'raise 0.5)
|
||||
(remove-display-text-property 6 10 'height)
|
||||
(should (equal-including-properties
|
||||
(buffer-string)
|
||||
#("Foo bar zot gazonk"
|
||||
1 3 (display (raise 0.5))
|
||||
3 5 (display [(raise 0.5) (height 2.0)])
|
||||
5 7 (display [(raise 0.5)])
|
||||
9 11 (display [(height 2.0)])))))
|
||||
(with-temp-buffer
|
||||
(should (equal-including-properties
|
||||
(let ((str (copy-sequence "Foo bar zot gazonk")))
|
||||
(add-display-text-property 3 11 'height 2.0 str)
|
||||
(add-display-text-property 1 7 'raise 0.5 str)
|
||||
(remove-display-text-property 5 9 'height str)
|
||||
str)
|
||||
#("Foo bar zot gazonk"
|
||||
1 3 (display (raise 0.5))
|
||||
3 5 (display ((raise 0.5) (height 2.0)))
|
||||
5 7 (display ((raise 0.5)))
|
||||
9 11 (display (height 2.0)))))))
|
||||
|
||||
(ert-deftest subr-x-named-let ()
|
||||
(let ((funs ()))
|
||||
(named-let loop
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue