summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2024-03-29 10:44:27 +0100
committerDaniel Mendler <mail@daniel-mendler.de>2024-03-29 10:44:27 +0100
commit8ea189de9a791dfe6c0b2c72ddd434b45ebbbfe3 (patch)
tree4e09e58f0494842cd10c41f712a8ce4d9db15ba1
parente0b188b713777a7324a0151c242bf9ae0d94c310 (diff)
corfu--preview-current-p: Simplify
-rw-r--r--corfu.el9
1 files changed, 4 insertions, 5 deletions
diff --git a/corfu.el b/corfu.el
index e64bc47..1fa8f61 100644
--- a/corfu.el
+++ b/corfu.el
@@ -821,10 +821,9 @@ the last command must be listed in `corfu-continue-commands'."
(seq-contains-p (car corfu--input) corfu-separator)))
(funcall completion-in-region-mode--predicate)))))))
-(defun corfu--preview-current-p (&optional insert)
- "Return t if the selected candidate is previewed, with auto INSERT."
- (and (if insert (eq 'insert corfu-preview-current) corfu-preview-current)
- (>= corfu--index 0) (/= corfu--index corfu--preselect)))
+(defun corfu--preview-current-p ()
+ "Return t if the selected candidate is previewed."
+ (and corfu-preview-current (>= corfu--index 0) (/= corfu--index corfu--preselect)))
(defun corfu--preview-current (beg end)
"Show current candidate as overlay given BEG and END."
@@ -1125,7 +1124,7 @@ A scroll bar is displayed from LO to LO+BAR."
;; currently selected candidate and bail out of completion. This way you can
;; continue typing after selecting a candidate. The candidate will be inserted
;; and your new input will be appended.
- (and (corfu--preview-current-p 'insert)
+ (and (corfu--preview-current-p) (eq corfu-preview-current 'insert)
;; See the comment about `overriding-local-map' in `corfu--post-command'.
(not (or overriding-terminal-local-map
(corfu--match-symbol-p corfu-continue-commands this-command)))