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

From: Alan Mackenzie <[email-masked]>
Date: Fri, 28 Sep 2018 20:31:51 +0000

Hello, Eli.

On Thu, Sep 27, 2018 at 11:06:20 +0300, Eli Zaretskii wrote:
> > From: Allen Li <[email-masked]>
> > Date: Wed, 26 Sep 2018 15:49:15 -0700

> > Moving the cursor off the bottom of the window with follow-mode enabled
> > doesn't move to the other window properly if frame-resize-pixelwise is
> > set and a partial line is visible.

> It seems like setting make-cursor-line-fully-visible to nil solves the
> problem.  Could you try that for a while, and see if this has any
> adverse effects?

> Alan and Anders: does setting this variable to nil in buffers under
> follow-mode sounds like an okay solution?  It might mean that in some
> rare cases the user will see the current line only partially (only in
> the last window in the group).  If you think this is OK, we could
> arrange for that variable to be set locally as part of turning on
> follow-mode.

> A more complex solution would be to allow
> make-cursor-line-fully-visible have a value that is a function, which
> follow-mode will define in a way that will only allow
> partially-visible current line in a window if it is not the last one
> in the order returned by follow-all-followers.

> Comments?

The cause of this is this:
(i) The C-n moves point from the last full line of LH window (L33) to
partial line in LH window (L34).
(ii) Follow Mode's post-command-hook determines that point should move
to the RH window, and sets up the windows correctly for this.
(iii) To try to avoid the LH window scrolling, follow mode does this (at
follow-adjust-window L+94:

          ;; If a new window was selected, make sure that the old is
          ;; not scrolled when point is outside the window.
          (unless (eq win (selected-window))
            (let ((p (window-point win)))
              (set-window-start win (window-start win) nil)
              (set-window-point win p))))

Here, `win' is the LH window.  It specifically calls set-window-start
with a nil NO-FORCE argument to try to ensure the redisplay will move
point into the window rather than scrolling the window to include point.

(iv) Redisplay sees w->force_start true and
make_cursor_line_fully_visible_p also true.  These conflict with
eachother here.  Priority is given to make_cursor_...._p.

Why does w->force_start not have priority here?

-- 
Alan Mackenzie (Nuremberg, Germany).