summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2024-11-23 10:02:48 +0100
committerDaniel Mendler <mail@daniel-mendler.de>2024-11-23 10:28:39 +0100
commit9aecdc14cd4d5bdb12ec9cf0cd0fae10aa841e91 (patch)
treeef05f845dcf0cd3da0a472e94eb5acb4c7c33c66
parent784645b2c19ce4a2be19df2b8b90e77bfe93820d (diff)
Do not quit on empty inputno-quit-on-empty
When entering a trigger character, e.g., a dot, the popup will show even on empty input. This change prevents flicker for the sequence of inputs: "obj. -> obj.fun -> obj.". The downside of the change is backspacing the popup doesn't work anymore in all cases - it depends on the Capf.
-rw-r--r--corfu.el14
1 files changed, 6 insertions, 8 deletions
diff --git a/corfu.el b/corfu.el
index 9051aae..db625a7 100644
--- a/corfu.el
+++ b/corfu.el
@@ -814,14 +814,12 @@ the last command must be listed in `corfu-continue-commands'."
(or overriding-terminal-local-map
;; Check if it is an explicitly listed continue command
(corfu--match-symbol-p corfu-continue-commands this-command)
- (pcase-let ((`(,beg ,end . ,_) completion-in-region--data))
- (and (or (not corfu--input) (< beg end)) ;; Check for empty input
- (or (not corfu-quit-at-boundary) ;; Check separator or predicate
- (and (eq corfu-quit-at-boundary 'separator)
- (or (eq this-command #'corfu-insert-separator)
- ;; with separator, any further chars allowed
- (seq-contains-p (car corfu--input) corfu-separator)))
- (funcall completion-in-region-mode--predicate)))))))
+ (and (or (not corfu-quit-at-boundary) ;; Check separator or predicate
+ (and (eq corfu-quit-at-boundary 'separator)
+ (or (eq this-command #'corfu-insert-separator)
+ ;; with separator, any further chars allowed
+ (seq-contains-p (car corfu--input) corfu-separator)))
+ (funcall completion-in-region-mode--predicate))))))
(defun corfu--preview-current-p ()
"Return t if the selected candidate is previewed."