summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2022-12-21 23:36:11 +0100
committerDaniel Mendler <mail@daniel-mendler.de>2022-12-21 23:36:11 +0100
commitaaa740b7feee1322b010ac003a74eb9ed6164d5e (patch)
tree2dfed8b681790e9d54148b5087aa7ab1799300de
parent8b4c3c27ab49b7a5f42d880565e4c8b2d01bc025 (diff)
preselect prototype
-rw-r--r--corfu.el7
1 files changed, 5 insertions, 2 deletions
diff --git a/corfu.el b/corfu.el
index 1670113..e30de4e 100644
--- a/corfu.el
+++ b/corfu.el
@@ -644,12 +644,15 @@ A scroll bar is displayed from LO to LO+BAR."
;; equal to the first candidate. This condition prevents jumping to prompt
;; during completion for the full candidate when the incomplete candidate
;; is invalid.
- (corfu--preselect . ,(if (or (not corfu-preselect-first) (not all)
- (and (not (equal field (car all)))
+ (corfu--preselect . ,(if (or (eq corfu-preselect 'prompt) (not all)
+ (and (eq corfu-preselect 'valid)
+ (not (equal field (car all)))
(not (and completing-file (equal (concat field "/") (car all))))
(test-completion str table pred)))
-1 0)))))
+(defvar corfu-preselect 'prompt) ;; 'prompt 'first 'valid
+
(defun corfu--update (&optional interruptible)
"Update state, optionally INTERRUPTIBLE."
(pcase-let* ((`(,beg ,end ,table ,pred) completion-in-region--data)