[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/company 3a5694426f 01/10: Handle input interruption wit
From: |
ELPA Syncer |
Subject: |
[elpa] externals/company 3a5694426f 01/10: Handle input interruption with throw-catch |
Date: |
Wed, 12 Jun 2024 18:57:42 -0400 (EDT) |
branch: externals/company
commit 3a5694426f69b8e35a43d5e8523628f211f3f198
Author: Dmitry Gutov <dmitry@gutov.dev>
Commit: Dmitry Gutov <dmitry@gutov.dev>
Handle input interruption with throw-catch
Employ the scheme previously devised by lsp-mode folks: keep the old list of
completions (setting it to nil is what created the flicker) but updated the
prefix.
This is for "continue" case, of course. begin-new should still fail.
#1468
---
company.el | 32 +++++++++++++++++++-------------
1 file changed, 19 insertions(+), 13 deletions(-)
diff --git a/company.el b/company.el
index 2764bbff09..3f6a6e04d3 100644
--- a/company.el
+++ b/company.el
@@ -1617,9 +1617,11 @@ update if FORCE-UPDATE."
(while (member (car unread-command-events)
'(company-foo (t . company-foo)))
(pop unread-command-events))
- (prog1
- (and (consp res) res)
- (setq res 'exited))))))
+ (let ((res-was res))
+ (setq res 'exited)
+ (if (eq 'none res-was)
+ (throw 'interrupted 'new-input)
+ res-was))))))
(defun company--sneaky-refresh ()
(when company-candidates (company-call-frontends 'unhide))
@@ -2201,13 +2203,16 @@ For more details see `company-insertion-on-trigger' and
(setq company-candidates-cache nil))
(let* ((new-prefix (company-call-backend 'prefix))
(ignore-case (company-call-backend 'ignore-case))
- (c (when (and (company--good-prefix-p new-prefix
- (company--prefix-min-length))
- (setq new-prefix (company--prefix-str new-prefix))
- (= (- (point) (length new-prefix))
- (- company-point (length company-prefix))))
- (company-calculate-candidates new-prefix ignore-case))))
+ (c (catch 'interrupted
+ (when (and (company--good-prefix-p new-prefix
+ (company--prefix-min-length))
+ (setq new-prefix (company--prefix-str new-prefix))
+ (= (- (point) (length new-prefix))
+ (- company-point (length company-prefix))))
+ (company-calculate-candidates new-prefix ignore-case)))))
(cond
+ ((eq c 'new-input) ; Keep the old completions, but update prefix.
+ (setq company-prefix new-prefix))
((and company-abort-on-unique-match
(company--unique-match-p c new-prefix ignore-case))
;; Handle it like completion was aborted, to differentiate from user
@@ -2251,8 +2256,12 @@ For more details see `company-insertion-on-trigger' and
(company-call-backend 'set-min-prefix min-prefix)
(setq company-prefix (company--prefix-str prefix)
company-backend backend
- c (company-calculate-candidates company-prefix ignore-case))
+ c (catch 'interrupted
+ (company-calculate-candidates company-prefix
ignore-case)))
(cond
+ ((or (null c) (eq c 'new-input))
+ (when company--manual-action
+ (message "No completion found")))
((and company-abort-on-unique-match
(company--unique-match-p c company-prefix ignore-case)
(if company--manual-action
@@ -2262,9 +2271,6 @@ For more details see `company-insertion-on-trigger' and
t))
;; ...abort and run the hooks, e.g. to clear the cache.
(company-cancel 'unique))
- ((null c)
- (when company--manual-action
- (message "No completion found")))
(t ;; We got completions!
(when company--manual-action
(setq company--manual-prefix prefix))
- [elpa] externals/company updated (6c7731d4ec -> 24c804393e), ELPA Syncer, 2024/06/12
- [elpa] externals/company 3a5694426f 01/10: Handle input interruption with throw-catch,
ELPA Syncer <=
- [elpa] externals/company a66beb5344 03/10: Merge branch 'master' into async_no_cache_flicker, ELPA Syncer, 2024/06/12
- [elpa] externals/company e27597f6f9 07/10: company-capf--candidates: Make sure to check 'non-essential', ELPA Syncer, 2024/06/12
- [elpa] externals/company 61d992bd62 08/10: Remove :company-use-while-no-input, just default to interrupting, ELPA Syncer, 2024/06/12
- [elpa] externals/company e23eccdb37 02/10: company-capf: Add property :company-use-while-no-input, ELPA Syncer, 2024/06/12
- [elpa] externals/company 882fbe8572 05/10: Synchronize async backend in fewer cases and lay further groundwork, ELPA Syncer, 2024/06/12
- [elpa] externals/company 854e48fa80 04/10: Add tests for capf interruption handling, ELPA Syncer, 2024/06/12
- [elpa] externals/company 24c804393e 10/10: Merge pull request #1471 from company-mode/async_no_cache_flicker, ELPA Syncer, 2024/06/12
- [elpa] externals/company b225aee4db 06/10: Narrow down the "forced sync" cases further, ELPA Syncer, 2024/06/12
- [elpa] externals/company 566c273678 09/10: Document the change in NEWS, ELPA Syncer, 2024/06/12