[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/corfu 16cba87 2/2: corfu-complete: Fix cycling
From: |
ELPA Syncer |
Subject: |
[elpa] externals/corfu 16cba87 2/2: corfu-complete: Fix cycling |
Date: |
Mon, 22 Nov 2021 23:57:14 -0500 (EST) |
branch: externals/corfu
commit 16cba8714966e24fdae7f457cfa482e0c3d449c5
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
corfu-complete: Fix cycling
---
corfu.el | 28 ++++++++++++++++------------
1 file 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."