Subject: bug#7464: 24.0.50; mouse highlighting vanishes upon unsplitting window

From: Eli Zaretskii <[email-masked]>
Date: Fri, 30 Mar 2012 12:10:05 +0300

> From: Stephen Berman <[email-masked]>
> Cc: [email-masked],  [email-masked]
> Date: Fri, 30 Mar 2012 10:44:52 +0200
> 
> I tried to make a simple test case, but I think I still don't understand
> exactly what to do.  I started my Athena build, in order to circumvent
> GTK+ interference with Emacs redisplay, under gdb with -Q, set a
> breakpoint at Fdelete_other_windows_internal, in Emacs switched to a new
> buffer, typed "test" at line 1, column 0 and then M-: (put-text-property
> (point-min) (point-max) 'mouse-face 'highlight).  Then I typed C-x 2,
> put the mouse over the word "test", highlighting it, typed C-x 1 and
> proceeded in gdb thus:
> [...]
> 3631                int vpos = MATRIX_ROW_VPOS (row, desired_matrix);
> (gdb) p vpos
> $4 = 268435456

vpos is garbage because line 3631 was not yet executed, you stopped
_before_ it.

> 3655                changed_p |= update_window_line (w, vpos,
> (gdb) p vpos
> $6 = 0
> (gdb) n
> 3667                if (MATRIX_ROW_BOTTOM_Y (row) >= yb)
> (gdb) p vpos
> $7 = 0
> (gdb) p mouse_face_overwritten_p
> $8 = 0

Since you put the mouse highlighting on the 1st line of the window,
its vpos is zero, so the fact that the call to update_window_line
returned with mouse_face_overwritten_p set to zero means that the bug
is present.  At this point, if you look at the Emacs display, is the
mouse highlighting still visible?  I believe in the non-GTK build the
highlighting disappears when update_window_line is called for the line
with highlighting.

> At this point (vpos = 1) aren't we past the highlighted text?

In your example, we are past it when vpos is zero.

> Yet nothing has changed.  What I am doing wrong?

I think you are in the wrong call to update_window_line (for another
window).  At this point, type "continue" and repeat the above steps
when you are inside update_window_line again.  I think this next call
to update_window_line is for the correct window.