emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/corfu 65dd164b25 1/3: Store a string in corfu--base


From: ELPA Syncer
Subject: [elpa] externals/corfu 65dd164b25 1/3: Store a string in corfu--base
Date: Mon, 11 Apr 2022 11:57:23 -0400 (EDT)

branch: externals/corfu
commit 65dd164b2599763016b4e8429578f30ad68488e8
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    Store a string in corfu--base
---
 corfu.el | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/corfu.el b/corfu.el
index 2e3fa55f6d..cb43c90bc2 100644
--- a/corfu.el
+++ b/corfu.el
@@ -251,8 +251,8 @@ The completion backend can override this with
 (defvar-local corfu--metadata nil
   "Completion metadata.")
 
-(defvar-local corfu--base 0
-  "Size of the base string, which is concatenated with the candidate.")
+(defvar-local corfu--base ""
+  "Base string, which is concatenated with the candidate.")
 
 (defvar-local corfu--total 0
   "Length of the candidate list `corfu--candidates'.")
@@ -614,7 +614,7 @@ A scroll bar is displayed from LO to LO+BAR."
     (when (and completing-file (not (string-suffix-p "/" field)))
       (setq all (corfu--move-to-front (concat field "/") all)))
     (setq all (corfu--move-to-front field all))
-    (list base all (length all) hl corfu--metadata
+    (list (substring str 0 base) all (length all) hl corfu--metadata
           ;; Select the prompt when the input is a valid completion
           ;; and if it is not equal to the first candidate.
           (if (or (not corfu-preselect-first) (not all)
@@ -760,7 +760,7 @@ there hasn't been any input, then quit."
       (setq lo (max 1 lo)))
     (when (/= last corfu--total)
       (setq lo (min (- corfu-count bar 2) lo)))
-    (corfu--popup-show (+ pos corfu--base) pw width fcands (- corfu--index 
corfu--scroll)
+    (corfu--popup-show (+ pos (length corfu--base)) pw width fcands (- 
corfu--index corfu--scroll)
                        (and (> corfu--total corfu-count) lo) bar)))
 
 (defun corfu--preview-current (beg end str)
@@ -773,7 +773,7 @@ there hasn't been any input, then quit."
     (overlay-put corfu--preview-ov 'window (selected-window))
     (overlay-put corfu--preview-ov
                  (if (= beg end) 'after-string 'display)
-                 (concat (substring str 0 corfu--base) cand))))
+                 (concat corfu--base cand))))
 
 (defun corfu--echo-refresh ()
   "Refresh echo message to prevent flicker during redisplay."
@@ -1027,7 +1027,7 @@ If a candidate is selected, insert it."
     ;; "~/emacs/master/lisp/", but not the suffix "/calc". Default
     ;; completion has the same problem when selecting in the
     ;; *Completions* buffer. See bug#48356.
-    (setq str (concat (substring str 0 corfu--base)
+    (setq str (concat corfu--base
                       (substring-no-properties (nth corfu--index 
corfu--candidates))))
     (completion--replace beg end str)
     (corfu--goto -1) ;; Reset selection, but continue completion.
@@ -1132,7 +1132,7 @@ See `completion-in-region' for the arguments BEG, END, 
TABLE, PRED."
              (if (or (= total 0) (not threshold)
                      (and (not (eq threshold t)) (< threshold total)))
                  (corfu--setup)
-               (corfu--cycle-candidates total candidates (+ base beg) end)
+               (corfu--cycle-candidates total candidates (+ (length base) beg) 
end)
                ;; Do not show Corfu when "trivially" cycling, i.e.,
                ;; when the completion is finished after the candidate.
                (unless (equal (completion-boundaries



reply via email to

[Prev in Thread] Current Thread [Next in Thread]