[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/capf-autosuggest 531b04c 07/63: Take completion boundar
From: |
ELPA Syncer |
Subject: |
[elpa] externals/capf-autosuggest 531b04c 07/63: Take completion boundaries/base into account |
Date: |
Wed, 27 Oct 2021 14:57:54 -0400 (EDT) |
branch: externals/capf-autosuggest
commit 531b04c2e1eb96c26f855fc04f40659bfbd5c9bd
Author: jakanakaevangeli <jakanakaevangeli@chiru.no>
Commit: jakanakaevangeli <jakanakaevangeli@chiru.no>
Take completion boundaries/base into account
---
capf-autosuggest.el | 40 +++++++++++++++++++++-------------------
1 file changed, 21 insertions(+), 19 deletions(-)
diff --git a/capf-autosuggest.el b/capf-autosuggest.el
index 6c9ec6b..9662ca1 100644
--- a/capf-autosuggest.el
+++ b/capf-autosuggest.el
@@ -109,25 +109,27 @@ point forward."
'capf-autosuggest-capf)
#'completion--capf-wrapper 'all)
(`(,_fun ,beg ,end ,table . ,plist)
- (when-let*
- ((completions
- (let ((capf-autosuggest-all-completions-only-one t))
- ;; Use `all-completions' rather than
- ;; `completion-all-completions' to bypass completion
- ;; styles and perform only prefix completions. This makes
- ;; sense here as we only use the string without the
- ;; prefix for the overlay.
- (all-completions (buffer-substring-no-properties beg end)
- table (plist-get plist :predicate))))
- (str (substring (car completions) (- end beg)))
- ((/= 0 (length str))))
- (setq capf-autosuggest--region (cons beg end)
- capf-autosuggest--str (copy-sequence str))
- (move-overlay capf-autosuggest--overlay end end)
- (add-text-properties 0 1 (list 'cursor (length str)) str)
- (add-face-text-property 0 (length str) 'capf-autosuggest-face t str)
- (overlay-put capf-autosuggest--overlay 'after-string str)
- (capf-autosuggest-active-mode)))))))
+ (let* ((pred (plist-get plist :predicate))
+ (string (buffer-substring-no-properties beg end))
+ (base (car (completion-boundaries string table pred ""))))
+ (when-let*
+ ((completions
+ (let ((capf-autosuggest-all-completions-only-one t))
+ ;; Use `all-completions' rather than
+ ;; `completion-all-completions' to bypass completion styles
+ ;; and strictly match only on prefix. This makes sense here
+ ;; as we only use the string without the prefix for the
+ ;; overlay.
+ (all-completions string table pred)))
+ (str (substring (car completions) (- end beg base)))
+ ((/= 0 (length str))))
+ (setq capf-autosuggest--region (cons beg end)
+ capf-autosuggest--str (copy-sequence str))
+ (move-overlay capf-autosuggest--overlay end end)
+ (add-text-properties 0 1 (list 'cursor (length str)) str)
+ (add-face-text-property 0 (length str) 'capf-autosuggest-face t
str)
+ (overlay-put capf-autosuggest--overlay 'after-string str)
+ (capf-autosuggest-active-mode))))))))
;;;###autoload
(define-minor-mode capf-autosuggest-mode
- [elpa] branch externals/capf-autosuggest created (now 2821a6a), ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest 531b04c 07/63: Take completion boundaries/base into account,
ELPA Syncer <=
- [elpa] externals/capf-autosuggest dd21f4b 08/63: Fix capf-autosuggest-accept, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest cad5308 01/63: Initial commit, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest 3fd798f 12/63: Make capf-autosuggest-capf nil by default, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest 3c346b7 13/63: Added history-capf.el, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest c6a38f3 17/63: Sentence end double space, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest 0ef9e94 16/63: Add documentation to capf functions, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest 03004ef 18/63: Begin commentary to capf-autosuggest, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest 8507236 20/63: Generalize capf-autosuggest-capf-functions, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest d53b499 24/63: insert -> insert-and-inherit, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest 2163c64 27/63: after-change-functions -> buffer-modified-tick, ELPA Syncer, 2021/10/27