emacs-diffs
[Top][All Lists]
Advanced

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

scratch/icomplete-vertical-mode-improvements f751980 05/10: Don't break


From: João Távora
Subject: scratch/icomplete-vertical-mode-improvements f751980 05/10: Don't break icomplete-vertical-mode scrolling when moving non-destructively
Date: Fri, 28 May 2021 06:10:05 -0400 (EDT)

branch: scratch/icomplete-vertical-mode-improvements
commit f751980652f6df3ddd7b4c8e5ee3090e57abbfb9
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>

    Don't break icomplete-vertical-mode scrolling when moving non-destructively
    
    * lisp/icomplete.el (icomplete--render-vertical): Rework.
---
 lisp/icomplete.el | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index 82be6ea..4c651e2 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -696,13 +696,15 @@ See `icomplete-mode' and `minibuffer-setup-hook'."
               (overlay-put icomplete-overlay 'after-string text))))))))
 
 (defun icomplete--render-vertical (comps)
-  ;; First attempt to keep selection stable.
+  ;; First attempt to keep selection stable.  Do this only if the
+  ;; selection didn't change but the candidates did.
   (when (and icomplete--last-selected
+             (not (eq (cdr icomplete--last-selected) (buffer-modified-tick)))
              (null icomplete-rotate))
     (cl-loop
      with preds
      for (comp . rest) on comps
-     when (equal comp icomplete--last-selected)
+     when (equal comp (car icomplete--last-selected))
      do
      (setq icomplete--comp-predecessors preds
            comps (cons comp rest))
@@ -739,8 +741,9 @@ See `icomplete-mode' and `minibuffer-setup-hook'."
              (nconc before
                     (list
                      (setq icomplete--last-selected
-                           (propertize (car comps) 'face
-                                       'icomplete-selected-match)))
+                           (cons (propertize (car comps) 'face
+                                             'icomplete-selected-match)
+                                 (buffer-modified-tick)))))
                     after)
              icomplete-separator)))))
 



reply via email to

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