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

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

[elpa] externals/corfu 7e5710c: Show corfu--overlay after popup


From: Protesilaos Stavrou
Subject: [elpa] externals/corfu 7e5710c: Show corfu--overlay after popup
Date: Fri, 14 May 2021 06:41:48 -0400 (EDT)

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

    Show corfu--overlay after popup
    
    This ensures that the position computation of the popup is not affected by 
the
    overlay. Otherwise the popup will move in the eshell when scrolling through 
the
    available candidates.
---
 corfu.el | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/corfu.el b/corfu.el
index 9f9d499..c59be1f 100644
--- a/corfu.el
+++ b/corfu.el
@@ -466,20 +466,17 @@ Set to nil in order to disable confirmation."
          (lo (min (- corfu-count bar 1) (floor (* corfu-count start) 
corfu--total)))
          (cands (funcall corfu--highlight (seq-subseq corfu--candidates start 
last)))
          (ann-cands (mapcar (corfu--format-candidate) (corfu--annotate 
metadata cands))))
-    (when corfu--overlay
-      (delete-overlay corfu--overlay)
-      (setq corfu--overlay nil))
-    (when (>= curr 0)
-      (setq corfu--overlay (make-overlay beg end nil t t))
-      (overlay-put corfu--overlay 'priority 1000)
-      (overlay-put corfu--overlay 'window (selected-window))
-      (overlay-put corfu--overlay 'display (concat (substring str 0 
corfu--base) (nth curr cands))))
     ;; Nonlinearity at the end and the beginning
     (when (/= start 0)
       (setq lo (max 1 lo)))
     (when (/= last corfu--total)
       (setq lo (min (- corfu-count bar 2) lo)))
-    (corfu--popup-show (+ beg corfu--base) ann-cands curr (and (> corfu--total 
corfu-count) lo) bar)))
+    (corfu--popup-show (+ beg corfu--base) ann-cands curr (and (> corfu--total 
corfu-count) lo) bar)
+    (when (>= curr 0)
+      (setq corfu--overlay (make-overlay beg end nil t t))
+      (overlay-put corfu--overlay 'priority 1000)
+      (overlay-put corfu--overlay 'window (selected-window))
+      (overlay-put corfu--overlay 'display (concat (substring str 0 
corfu--base) (nth curr cands))))))
 
 (defun corfu--update ()
   "Refresh Corfu UI."
@@ -488,6 +485,9 @@ Set to nil in order to disable confirmation."
                (str (buffer-substring-no-properties beg end))
                (metadata (completion-metadata (substring str 0 pt) table pred))
                (initializing (not corfu--input)))
+    (when corfu--overlay
+      (delete-overlay corfu--overlay)
+      (setq corfu--overlay nil))
     (cond
      ;; XXX Guard against errors during candidate generation.
      ;; Turn off completion immediately if there are errors



reply via email to

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