[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/corfu 60f134a: Simplify quitting behavior
From: |
ELPA Syncer |
Subject: |
[elpa] externals/corfu 60f134a: Simplify quitting behavior |
Date: |
Sun, 17 Oct 2021 14:57:10 -0400 (EDT) |
branch: externals/corfu
commit 60f134a3561570b27761292f543c0af40b3277a2
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Simplify quitting behavior
* Disable completion-in-region--postch in favor of the Corfu quitting
criteria
* Check if point is still on the same line as the completion beginning
---
corfu.el | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/corfu.el b/corfu.el
index af2a7c3..6efc776 100644
--- a/corfu.el
+++ b/corfu.el
@@ -72,8 +72,8 @@
(defcustom corfu-quit-at-boundary nil
"Automatically quit at completion field/word boundary.
-If automatic quitting is disabled, Orderless filtering is facilitated since a
-filter string with spaces is allowed."
+If automatic quitting is disabled, Orderless filter strings with spaces
+are allowed."
:type 'boolean)
(defcustom corfu-quit-no-match 1.0
@@ -709,7 +709,14 @@ completion began less than that number of seconds ago."
(remove-hook 'window-configuration-change-hook #'corfu-quit)
(or (pcase completion-in-region--data
(`(,beg ,end ,_table ,_pred)
- (when (and (eq (marker-buffer beg) (current-buffer)) (<= beg (point)
end))
+ (when (let ((pt (point)))
+ (and (eq (marker-buffer beg) (current-buffer))
+ (<= beg pt end)
+ (save-excursion
+ (goto-char beg)
+ (<= (line-beginning-position) pt (line-end-position)))
+ (or (not corfu-quit-at-boundary)
+ (funcall completion-in-region-mode--predicate))))
(corfu--update #'minibuffer-message))))
(corfu-quit)))
@@ -871,6 +878,9 @@ completion began less than that number of seconds ago."
(setcdr (assq #'completion-in-region-mode minor-mode-overriding-map-alist)
corfu-map)
(add-hook 'pre-command-hook #'corfu--pre-command nil 'local)
(add-hook 'post-command-hook #'corfu--post-command nil 'local)
+ ;; Disable default post-command handling, since we have our own
+ ;; checks in `corfu--post-command'.
+ (remove-hook 'post-command-hook #'completion-in-region--postch)
(let ((sym (make-symbol "corfu--teardown"))
(buf (current-buffer)))
(fset sym (lambda ()
@@ -906,13 +916,9 @@ completion began less than that number of seconds ago."
(corfu-quit))
(let ((completion-show-inline-help)
(completion-auto-help)
- ;; XXX Disable original predicate check, keep completion alive when
- ;; popup is shown. Since the predicate is set always, it is ensured
- ;; that `completion-in-region-mode' is turned on.
+ ;; Set the predicate to ensure that `completion-in-region-mode' is
enabled.
(completion-in-region-mode-predicate
- (or (and corfu-quit-at-boundary
- completion-in-region-mode-predicate)
- (lambda () t))))
+ (or completion-in-region-mode-predicate (lambda () t))))
(prog1 (apply #'completion--in-region args)
(corfu--setup)))))
@@ -929,11 +935,7 @@ completion began less than that number of seconds ago."
(guard (>= (- (point) beg) corfu-auto-prefix)))
(let ((completion-extra-properties plist)
(completion-in-region-mode-predicate
- (if corfu-quit-at-boundary
- (lambda ()
- (when-let (newbeg (car-safe (funcall fun)))
- (= newbeg beg)))
- (lambda () t))))
+ (lambda () (eq beg (car-safe (funcall fun))))))
(setq completion-in-region--data `(,(copy-marker beg) ,(copy-marker
end t)
,table ,(plist-get plist
:predicate))
corfu--auto-start (float-time))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/corfu 60f134a: Simplify quitting behavior,
ELPA Syncer <=