emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 01/01: Fix bug #19157 with incorrect hscroll during


From: Eli Zaretskii
Subject: [Emacs-diffs] master 01/01: Fix bug #19157 with incorrect hscroll during I-search.
Date: Mon, 24 Nov 2014 13:33:05 +0000

branch: master
commit 9faf591a66aa0c5ab4522f2077c170b79e95c9ec
Author: Eli Zaretskii <address@hidden>
Date:   Mon Nov 24 15:32:14 2014 +0200

    Fix bug #19157 with incorrect hscroll during I-search.
    
     lisp/isearch.el (isearch-update): Don't assume
     pos-visible-in-window-p will return nil when point is hscrolled
     out of view.
---
 lisp/ChangeLog  |    6 ++++++
 lisp/isearch.el |   13 ++++++++++---
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c3a01da..26376af 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2014-11-24  Eli Zaretskii  <address@hidden>
+
+       * isearch.el (isearch-update): Don't assume
+       pos-visible-in-window-p will return nil when point is hscrolled
+       out of view.  (Bug#19157)
+
 2014-11-20  Andrey Kotlarski  <address@hidden>
 
        * net/eww.el (eww-browse-url): Optionally create new eww buffer.
diff --git a/lisp/isearch.el b/lisp/isearch.el
index f0ce705..c3e473a 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -974,10 +974,17 @@ The last thing it does is to run 
`isearch-update-post-hook'."
                 (other-window 1))
               (goto-char found-point))
          ;; Keep same hscrolling as at the start of the search when possible
-         (let ((current-scroll (window-hscroll)))
+         (let ((current-scroll (window-hscroll))
+               visible-p)
            (set-window-hscroll (selected-window) isearch-start-hscroll)
-           (unless (pos-visible-in-window-p)
-             (set-window-hscroll (selected-window) current-scroll))))
+           (setq visible-p (pos-visible-in-window-p nil nil t))
+           (if (or (not visible-p)
+                   ;; When point is not visible because of hscroll,
+                   ;; pos-visible-in-window-p returns non-nil, but
+                   ;; the X coordinate it returns is 1 pixel beyond
+                   ;; the last visible one.
+                   (>= (car visible-p) (window-body-width nil t)))
+               (set-window-hscroll (selected-window) current-scroll))))
        (if isearch-other-end
             (if (< isearch-other-end (point)) ; isearch-forward?
                 (isearch-highlight isearch-other-end (point))



reply via email to

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