summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2021-11-23 05:14:21 +0100
committerDaniel Mendler <mail@daniel-mendler.de>2021-11-23 05:14:21 +0100
commit16cba8714966e24fdae7f457cfa482e0c3d449c5 (patch)
tree600e2eb54285b277110f54c11e285f451dc1d021
parent74f1ba7dd06758a7c93b1907955728febc606a72 (diff)
corfu-complete: Fix cycling
-rw-r--r--corfu.el28
1 files changed, 16 insertions, 12 deletions
diff --git a/corfu.el b/corfu.el
index 69d5857..4984c9c 100644
--- a/corfu.el
+++ b/corfu.el
@@ -937,18 +937,22 @@ there hasn't been any input, then quit."
(defun corfu-complete ()
"Try to complete current input."
(interactive)
- (cond
- ;; Continue completion with selected candidate
- ((>= corfu--index 0) (corfu--insert nil))
- ;; Try to complete the current input string
- (t (pcase-let* ((`(,beg ,end ,table ,pred) completion-in-region--data)
- (pt (max 0 (- (point) beg)))
- (str (buffer-substring-no-properties beg end))
- (metadata (completion-metadata (substring str 0 pt) table pred)))
- (pcase (completion-try-completion str table pred pt metadata)
- (`(,newstr . ,newpt)
- (completion--replace beg end newstr)
- (goto-char (+ beg newpt))))))))
+ (pcase-let ((`(,beg ,end ,table ,pred) completion-in-region--data))
+ (cond
+ ;; Proceed with cycling
+ (completion-cycling
+ (let ((completion-extra-properties corfu--extra))
+ (completion-in-region beg end table pred)))
+ ;; Continue completion with selected candidate
+ ((>= corfu--index 0) (corfu--insert nil))
+ ;; Try to complete the current input string
+ (t (let* ((pt (max 0 (- (point) beg)))
+ (str (buffer-substring-no-properties beg end))
+ (metadata (completion-metadata (substring str 0 pt) table pred)))
+ (pcase (completion-try-completion str table pred pt metadata)
+ (`(,newstr . ,newpt)
+ (completion--replace beg end newstr)
+ (goto-char (+ beg newpt)))))))))
(defun corfu--insert (status)
"Insert current candidate, exit with STATUS if non-nil."