diff options
| author | Eshel Yaron | 2024-06-29 11:51:10 +0200 |
|---|---|---|
| committer | Eshel Yaron | 2024-06-29 15:14:18 +0200 |
| commit | 2119cd52cdb58221a850360bf65c91cf3bf4b47e (patch) | |
| tree | 6cf373a222391a74dd19186458f7b6a9d6a0a1ec /test | |
| parent | 3088b0675966160806a4487c6ff97ae8a071d217 (diff) | |
| download | emacs-2119cd52cdb58221a850360bf65c91cf3bf4b47e.tar.gz emacs-2119cd52cdb58221a850360bf65c91cf3bf4b47e.zip | |
Inherit text props in Completion Preview insertion commands
When completing with Completion Preview mode commands,
inherit text properties from surrounding text similarly to
other completion commands, such as 'completion-at-point'.
* lisp/completion-preview.el (completion-preview-insert)
(completion-preview-partial-insert)
(completion-preview-complete): Use 'insert-and-inherit'
instead of 'insert' to insert text for completion.
* test/lisp/completion-preview-tests.el
(completion-preview-insert-inherits-text-properties): New
test.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/completion-preview-tests.el | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/lisp/completion-preview-tests.el b/test/lisp/completion-preview-tests.el index 95985470479..b190ecb7020 100644 --- a/test/lisp/completion-preview-tests.el +++ b/test/lisp/completion-preview-tests.el | |||
| @@ -432,4 +432,17 @@ instead." | |||
| 432 | (should-not exit-fn-called) | 432 | (should-not exit-fn-called) |
| 433 | (should-not exit-fn-args)))) | 433 | (should-not exit-fn-args)))) |
| 434 | 434 | ||
| 435 | (ert-deftest completion-preview-insert-inherits-text-properties () | ||
| 436 | "Test that `completion-preview-insert' inherits text properties." | ||
| 437 | (with-temp-buffer | ||
| 438 | (setq-local completion-at-point-functions | ||
| 439 | (list (completion-preview-tests--capf '("foobar" "foobaz")))) | ||
| 440 | (insert (propertize "foo" 'prop 'val)) | ||
| 441 | (let ((this-command 'self-insert-command)) | ||
| 442 | (completion-preview--post-command)) | ||
| 443 | (completion-preview-tests--check-preview "bar" 'completion-preview-common) | ||
| 444 | (completion-preview-insert) | ||
| 445 | (should (string= (buffer-string) "foobar")) | ||
| 446 | (should (eq (get-text-property 6 'prop) 'val)))) | ||
| 447 | |||
| 435 | ;;; completion-preview-tests.el ends here | 448 | ;;; completion-preview-tests.el ends here |