Subject: Re: bug#18545: 24.4.50: Bug - forward-line inside with-selected-window

From: Eli Zaretskii <[email-masked]>
Date: Sat, 27 Sep 2014 19:06:17 +0300

> Date: Sat, 27 Sep 2014 15:36:49 +0200
> From: martin rudalics <[email-masked]>
> CC: [email-masked], [email-masked]
> 
>  > AFAIU, this means the window is not being redrawn on each
>  > forward-line; not even its mode line is updated.  You should be able
>  > to confirm this if you turn on trace-redisplay (assuming you've built
>  > with GLYPH_DEBUG, a.k.a. "--enable-checking=glyphs") -- you will not
>  > see the window announced in the trace.  (Btw, turning off
>  > blink-cursor-mode removes a lot of clutter from the redisplay trace,
>  > so I suggest to do that in these experiments.)
> 
> I attach an output, can't make much head or tail of it.  The *sidebar*
> window is the one with the problem, the .emacs window the one on the
> right of it.

AFAIU, it's indeed similar to the problem I solved with my previous
patch (the one you have installed).

> 117
> 122 [28 times]

This says point doesn't move, which I don't understand how can
happen.  forward-line doesn't care about anything except moving point
to the next line.

>  >> (gdb) p row->height
>  >> $5 = 16
>  >> (gdb) p row->visible_height
>  >> $6 = 16
>  >>
>  >> Any ideas?
>  >
>  > What is last_visible_y in that window?  To see that, step into
>  > try_window called on line 16235, wait until it calls start_display,
>  > and look at it.last_visible_y.
> 
> At the xdisp.c line reading:
> 
>    while (it.current_y < it.last_visible_y)
> 
> I have
> 
> (gdb) p it.last_visible_y
> $7 = 442
> 
> and (just to confirm the earlier posted) at the xdisp.c line reading
> 
> 	  if (new_vpos >= w->cursor.y)
> 
> I have:
> 
> (gdb) p new_vpos
> $10 = 426
> (gdb) p w->cursor.y
> $11 = 432

But if new_vpos is 426 and row->height is 16, then the last row, which
starts at y = 426, will end at y = 442, i.e. it's fully visible.  This
contradicts what you said earlier, that the last line is only
partially visible.

>  >> BTW is there a way to print the value returned by a macro in gdb?
>  >
>  > Yes, just print it:
>  >
>  >   (gdb) p MATRIX_ROW_PARTIALLY_VISIBLE_P (w, row)
> 
> Here I get
> 
> (gdb) p MATRIX_ROW_PARTIALLY_VISIBLE_P (w, row)
> No symbol "__FILE__" in current context.

I get this:

  (gdb) p MATRIX_ROW_PARTIALLY_VISIBLE_P(w,row)
  $1 = 0

>  > If this doesn't work, perhaps you didn't build with -g3,
> 
> I used CPPFLAGS='-DGLYPH_DEBUG=1' CFLAGS='-O0 -g3'
> 
>  > or your
>  > compiler is buggy.
> 
> Hmm...

Which GCC version is that?  I have 4.8.1 here.