[Top][All Lists]

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

bug#32848: 26.1; follow-mode cursor move breaks with frame-resize-pixelw

From: Alan Mackenzie
Subject: bug#32848: 26.1; follow-mode cursor move breaks with frame-resize-pixelwise
Date: Sun, 30 Sep 2018 14:09:21 +0000
User-agent: Mutt/1.10.1 (2018-07-13)

Hello again, Eli.

On Sun, Sep 30, 2018 at 15:56:58 +0300, Eli Zaretskii wrote:
> > Date: Sun, 30 Sep 2018 12:16:18 +0000
> > Cc: address@hidden, address@hidden, address@hidden
> > From: Alan Mackenzie <address@hidden>

> > > Now done on the master branch.

> > Great!

> > My bit is now ready, too, and I was just about to commit it.  But...

> > There's a problem.  If you move point with C-n from the LH window to the
> > RH window, LH point stays on the partially visible line.  If you now do
> > C-x o, point moves to that position, but follow-mode decides that the RH
> > window is appropriate for displaying that point, so C-x o appears not to
> > be working.

> I see this before the change, just by setting
> make-cursor-line-fully-visible to nil.  So it's not because of these
> changes.

> > I'll see what I can come up with to sort this out.

> Yes, probably follow-mode needs to apply some smarts here.

The problem was that LH point was "straddling" the window "edge".  The
solution appears to be to copy what happens when LH point is outside the
window, i.e. allow redisplay to move it back to the centre of the window.

For this, a simple (forward-line) suffices.

The trouble is, all the make-cursor-line-fully-visible stuff we've done
then becomes redundant, since point will never be left inside a partially
displayed line, except possibly at EOB.

Here's my current patch.  What do you think?

diff --git a/lisp/follow.el b/lisp/follow.el
index 7aa7b51473..6300be1909 100644
--- a/lisp/follow.el
+++ b/lisp/follow.el
@@ -1382,7 +1387,13 @@ follow-adjust-window
          (unless (eq win (selected-window))
            (let ((p (window-point win)))
              (set-window-start win (window-start win) nil)
-             (set-window-point win p))))
+              (if (nth 2 (pos-visible-in-window-p p win t))
+                  ;; p is in a partially visible line.  We can't leave
+                  ;; window-point there, because C-x o back into WIN
+                  ;; would then fail.
+                  (with-selected-window win
+                    (forward-line)) ; redisplay will recenter it in WIN.
+               (set-window-point win p)))))
        (unless visible
          ;; If point may not be visible in the selected window,

Alan Mackenzie (Nuremberg, Germany).

reply via email to

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