Subject: bug#29325: 26.0.90: Info scrolling stuck

From: [email-masked] (Charles A. Roelli)
Date: Wed, 22 Nov 2017 19:56:31 +0100

> Date: Tue, 21 Nov 2017 21:42:59 +0200
> From: Eli Zaretskii <[email-masked]>
> 
> > Date: Tue, 21 Nov 2017 20:24:05 +0100
> > From: [email-masked] (Charles A. Roelli)
> > CC: [email-masked]
> > 
> > > Then I'd expect the same behavior to happen if you do "M-5 M-v"
> > > instead of turning the wheel.  Does it?
> > 
> > It does.
> 
> Then let's abandon the wheel, and continue only with "M-5 M-v" from
> now on.

Ok.

> > redisplay_internal 0 <= START FIRST SCROLL
> > 0x1360330 (*info*): forced window start
> > redisplay_preserve_echo_area (8)
> > redisplay_internal 0
> > redisplay_preserve_echo_area (8)
> > redisplay_internal 0
> > redisplay_internal 0
> > redisplay_internal 0 <= START SECOND SCROLL
> > 0x1360330 (*info*): forced window start
> > redisplay_preserve_echo_area (8)
> > redisplay_internal 0
> > redisplay_preserve_echo_area (8)
> > redisplay_internal 0
> > redisplay_internal 0 <= START THIRD SCROLL (BROKEN)
> > redisplay_internal 0
> > 0x1360330 (*info*): recenter
> > redisplay_preserve_echo_area (8)
> > redisplay_internal 0
> > redisplay_preserve_echo_area (8)
> > redisplay_internal 0
> > redisplay_internal 0
> > 
> > The third scroll should have reached the start of the buffer, but
> > recenters instead of doing so.
> 
> Were you typing "M-5 M-v" or were you turning the mouse wheel?

This was with the wheel.  But the output when using "M-5 M-v" three
times in a row is equal, modulo some "redisplay_internal 0" lines.

> > When causing the problematic behavior, redisplay_window reaches
> > try_to_scroll via this if statement:
> > 
> >        if (!cursor_row_fully_visible_p (w, false, false))
> > 	{
> > 	  /* Point does appear, but on a line partly visible at end of window.
> > 	     Move it back to a fully-visible line.  */
> > 	  new_vpos = window_box_height (w);
> > 	  /* But if window_box_height suggests a Y coordinate that is
> > 	     not less than we already have, that line will clearly not
> > 	     be fully visible, so give up and scroll the display.
> > 	     This can happen when the default face uses a font whose
> > 	     dimensions are different from the frame's default
> > 	     font.  */
> > 	  if (new_vpos >= w->cursor.y)
> > 	    {
> > 	      w->cursor.vpos = -1;
> > 	      clear_glyph_matrix (w->desired_matrix);
> > 	      goto try_to_scroll;
> > 	    }
> > 	}
> > 
> > That is, (!cursor_row_fully_visible_p (w, false, false)) and
> > (new_vpos >= w->cursor.y) evaluate to true.
> 
> And what are the values of new_vpos and w->cursor.y in this case?  And
> what is w->cursor.vpos?

Before the last line here is executed:

 > 	  if (new_vpos >= w->cursor.y)
 > 	    {
 > 	      w->cursor.vpos = -1;

we have,

(gdb) p new_vpos
$1 = 561
(gdb) p w->cursor.y
$2 = 557
(gdb) p w->cursor.vpos
$3 = 27