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

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

[elpa] externals/isearch-mb b3f0b9f 5/6: Avoid recenter when ending the


From: ELPA Syncer
Subject: [elpa] externals/isearch-mb b3f0b9f 5/6: Avoid recenter when ending the search
Date: Sat, 29 May 2021 14:57:19 -0400 (EDT)

branch: externals/isearch-mb
commit b3f0b9f3d5bc58cc5a9ea39c947c61632787a088
Author: Augusto Stoffel <arstoffel@gmail.com>
Commit: Augusto Stoffel <arstoffel@gmail.com>

    Avoid recenter when ending the search
    
    `read-from-minibuffer' saves and restores the window configuration,
    and this may cause a recenter when ending the search.  This can only
    be avoided by manually undoing the recenter. See also:
    
    https://lists.gnu.org/archive/html/emacs-devel/2021-05/msg00862.html
    
    Closes #14
---
 isearch-mb.el | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/isearch-mb.el b/isearch-mb.el
index 919aa16..76ebe0f 100644
--- a/isearch-mb.el
+++ b/isearch-mb.el
@@ -187,11 +187,15 @@ minibuffer."
                    ;; avoid flicker.  As a side effect, window-start/end in
                    ;; `isearch-lazy-highlight-update' will have incorrect 
values,
                    ;; so we need to lazy-highlight the whole buffer.
-                   (lazy-highlight-buffer (not (null isearch-lazy-highlight))))
+                   (lazy-highlight-buffer (not (null isearch-lazy-highlight)))
+                   (wstart nil))
            (minibuffer-with-setup-hook
                (lambda ()
                  (add-hook 'after-change-functions #'isearch-mb--after-change 
nil 'local)
                  (add-hook 'post-command-hook #'isearch-mb--post-command-hook 
nil 'local)
+                 (add-hook 'minibuffer-exit-hook
+                           (lambda () (setq wstart (window-start 
(minibuffer-selected-window))))
+                           nil 'local)
                  (setq-local tool-bar-map isearch-tool-bar-map)
                  (setq isearch-mb--prompt-overlay (make-overlay (point-min) 
(point-min)
                                                                 
(current-buffer) t t))
@@ -215,6 +219,8 @@ minibuffer."
                       (delete-dups)
                       (mapcar (if isearch-regexp 'regexp-quote 'identity)))
                     t))
+               ;; Undo a possible recenter after quitting the minibuffer.
+               (set-window-start nil wstart)
                (dolist (fun isearch-mb--after-exit)
                  (advice-remove fun #'isearch-mb--after-exit))
                (dolist (fun isearch-mb--with-buffer)



reply via email to

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