From 9aecdc14cd4d5bdb12ec9cf0cd0fae10aa841e91 Mon Sep 17 00:00:00 2001 From: Daniel Mendler Date: Sat, 23 Nov 2024 10:02:48 +0100 Subject: Do not quit on empty input 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. --- corfu.el | 14 ++++++-------- 1 file 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." -- cgit v1.0