[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/corfu d786e77 4/4: Avoid recomputation for empty input
From: |
ELPA Syncer |
Subject: |
[elpa] externals/corfu d786e77 4/4: Avoid recomputation for empty input (Fix #48) |
Date: |
Mon, 9 Aug 2021 13:57:10 -0400 (EDT) |
branch: externals/corfu
commit d786e77573e8b78c48f1138ae88065336dce2e30
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Avoid recomputation for empty input (Fix #48)
---
corfu.el | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/corfu.el b/corfu.el
index 234488d..2456586 100644
--- a/corfu.el
+++ b/corfu.el
@@ -639,7 +639,10 @@ completion began less than that number of seconds ago."
(pt (- (point) beg))
(str (buffer-substring-no-properties beg end))
(metadata (completion-metadata (substring str 0 pt) table pred))
- (initializing (not corfu--input)))
+ (initializing (not corfu--input))
+ (continue (or (/= beg end)
+ (corfu--match-symbol-p corfu-continue-commands
+ this-command))))
(when corfu--overlay
(delete-overlay corfu--overlay)
(setq corfu--overlay nil))
@@ -652,7 +655,8 @@ completion began less than that number of seconds ago."
;; For example dabbrev throws error "No dynamic expansion ... found".
;; TODO Report this as a bug? Are completion tables supposed to throw
errors?
((condition-case err
- (unless (equal corfu--input (cons str pt))
+ ;; Only recompute when input changed and when input is non-empty
+ (when (and continue (not (equal corfu--input (cons str pt))))
(corfu--update-candidates str metadata pt table pred)
nil)
(t (message "%s" (error-message-string err))
@@ -662,8 +666,7 @@ completion began less than that number of seconds ago."
nil)
((and corfu--candidates ;; 2) There exist
candidates
(not (equal corfu--candidates (list str))) ;; & Not a sole exactly
matching candidate
- (or (/= beg end) ;; & Input is non-empty
or continue command
- (corfu--match-symbol-p corfu-continue-commands this-command)))
+ continue) ;; & Input is non-empty
or continue command
(corfu--show-candidates beg end str metadata) ;; => Show candidates
popup
t)
;; 3) When after `completion-at-point/corfu-complete', no further
completion is possible and the