Subject: bug#70038: 29.3.50; Shift up/down in buffer with images on M-x other-window with some fonts

From: Eli Zaretskii <[email-masked]>
Date: Wed, 17 Apr 2024 15:58:08 +0300

> Date: Wed, 17 Apr 2024 10:02:12 +0200
> Cc: [email-masked], [email-masked]
> From: martin rudalics <[email-masked]>
> 
>  > I hope this is now more clear.
> 
> Thanks.  So when we enter the part headed by
> 
>    if ((w->optional_new_start || window_frozen_p (w))
> 
> then the single aim is apparently to make sure that the cursor line
> remains fully visible.

Yes.  If it isn't, we will either move point or, if even that is
impossible, ignore the request to preserve window-start.

> When we enter that part because window_frozen_p (w) is set, we ignore
> the scroll margins because we assume that preserving the window start
> position is more important in this situation.
> 
> When we enter that part because w->optional_new_start was set, we assume
> that the caller ('recenter', 'delete-other-windows-internal') has done
> its part to obey the scroll margins but still might have failed to keep
> the cursor visible.
> 
> Is that interpretation correct?

No, we actually check that point doesn't end up inside scroll margins
(search for "Some people insist"), and move point or reject the
window-start if it did.

> If so, it might make sense to put some
> explanation into a comment for that part because, at least for me, it's
> a priori not clear that the same treatment is wanted for keeping the
> previous start position of a window and for one that has been explicitly
> changed.  I've spent almost an hour to arrive at the conclusion above.
> Things like this comment in 'delete-other-windows-internal'
> 
> 	  /* We need to do this, so that the window-scroll-functions
> 	     get called.  */
> 	  w->optional_new_start = true;
> 
> were distracting even further.

Where would you like to put the comment, and what should that comment
say?