aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorEshel Yaron2024-02-01 12:30:24 +0100
committerEshel Yaron2024-02-21 17:47:12 +0100
commite6882a5cc89d9375dfa73156db6836af19ef7b8a (patch)
tree446eca7a76257b0a54e376856e11cb58a31dbab4 /test
parent35d99b1ec7c56d4a5c09af36e6bbd7f0f959cccc (diff)
downloademacs-e6882a5cc89d9375dfa73156db6836af19ef7b8a.tar.gz
emacs-e6882a5cc89d9375dfa73156db6836af19ef7b8a.zip
; Fix mid-symbol updating/cycling completion preview
This fixes an issue where 'completion-preview-next-candidate' would fail to take into account the part of the symbol that follows point (the suffix) when point is at the middle of a symbol, as well as a similar issue in 'completion-preview--show' that would manifest with slow 'completion-at-point-functions'. * lisp/completion-preview.el (completion-preview-next-candidate) (completion-preview--show): Ensure that the completion preview remains at the end of a symbol, when updating it while point is in the middle of that symbol. * test/lisp/completion-preview-tests.el (completion-preview-mid-symbol-cycle): New test. (Bug#68875)
Diffstat (limited to 'test')
-rw-r--r--test/lisp/completion-preview-tests.el15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/lisp/completion-preview-tests.el b/test/lisp/completion-preview-tests.el
index 190764e9125..5b2c28bd3dd 100644
--- a/test/lisp/completion-preview-tests.el
+++ b/test/lisp/completion-preview-tests.el
@@ -181,4 +181,19 @@ instead."
181 (completion-preview--post-command)) 181 (completion-preview--post-command))
182 (completion-preview-tests--check-preview "barbaz" 'exact))) 182 (completion-preview-tests--check-preview "barbaz" 'exact)))
183 183
184(ert-deftest completion-preview-mid-symbol-cycle ()
185 "Test cycling the completion preview with point at the middle of a symbol."
186 (with-temp-buffer
187 (setq-local completion-at-point-functions
188 (list
189 (completion-preview-tests--capf
190 '("foobar" "foobaz"))))
191 (insert "fooba")
192 (forward-char -2)
193 (let ((this-command 'self-insert-command))
194 (completion-preview--post-command))
195 (completion-preview-tests--check-preview "r")
196 (completion-preview-next-candidate 1)
197 (completion-preview-tests--check-preview "z")))
198
184;;; completion-preview-tests.el ends here 199;;; completion-preview-tests.el ends here