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

From: Stephen Berman <[email-masked]>
Date: Fri, 30 Mar 2012 13:08:53 +0200

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

> 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?  

Yes, see also below.

>                                    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.

(I'm not sure this is still appropriate for the bugtracker; if you still
want to help me, maybe we should continue off list, though it's also
fine with me to keep it on list.)  I cannot tell in gdb when I'm in the
window with the mouse face highlighting.  I tried to do what you
suggested; here's the abbreviated protocol, with my comments and
questions interspersed:

  Breakpoint 3, Fdelete_other_windows_internal (window=141312565, root=139227370)
      at /data/steve/bzr/emacs/quickfixes/src/window.c:2569
  2569      w = decode_any_window (window);
  (gdb) p w
  $8 = (struct window *) 0x84c70ea

Is this the window with the mouse face highlighting or the deleted
window?

  (gdb) br redisplay_internal
  Breakpoint 6 at 0x8084dee: file /data/steve/bzr/emacs/quickfixes/src/xdisp.c, line 12669.
  (gdb) c
  Continuing.
  
  Breakpoint 6, redisplay_internal ()
      at /data/steve/bzr/emacs/quickfixes/src/xdisp.c:12669
  12669     struct window *w = XWINDOW (selected_window);
  (gdb) br update_window
  Breakpoint 7 at 0x8059e53: file /data/steve/bzr/emacs/quickfixes/src/dispnew.c, line 3547.
  (gdb) c
  Continuing.
  
  Breakpoint 7, update_window (w=0x8711888, force_p=1)
      at /data/steve/bzr/emacs/quickfixes/src/dispnew.c:3547
  3547      struct glyph_matrix *desired_matrix = w->desired_matrix;
  (gdb) n
  [...]
  3655                changed_p |= update_window_line (w, vpos,
  (gdb) p w
  $9 = (struct window *) 0x8711888

Or is this the window with the mouse face highlighting?

  (gdb) p vpos
  $10 = 0
  (gdb)  p mouse_face_overwritten_p
  $11 = 0

The highlighted text (still visible in the Emacs window) is in line 2,
so why is mouse_face_overwritten_p already 0?

  (gdb) c
  Continuing.
  
  Breakpoint 7, update_window (w=0x86c4230, force_p=1)
      at /data/steve/bzr/emacs/quickfixes/src/dispnew.c:3547
  3547      struct glyph_matrix *desired_matrix = w->desired_matrix;
  (gdb) n
  [...]
  3655                changed_p |= update_window_line (w, vpos,
  (gdb) p w
  $12 = (struct window *) 0x86c4230
  (gdb) p vpos
  $13 = 0
  (gdb)  p mouse_face_overwritten_p
  $14 = 0

Now we're on the first line of a third (which?) window...

  (gdb) c
  Continuing.
  
  Breakpoint 7, update_window (w=0x86f0e48, force_p=1)
      at /data/steve/bzr/emacs/quickfixes/src/dispnew.c:3547
  3547      struct glyph_matrix *desired_matrix = w->desired_matrix;
  (gdb) n
  [...]
  3655                changed_p |= update_window_line (w, vpos,
  (gdb) p vpos
  $15 = 0
  (gdb)  p mouse_face_overwritten_p
  $16 = 0

Fourth window...

  (gdb) c
  Continuing.

At this point the highlighting vanished.  Does that mean the fourth
window is the one that contained the highlighting?
  
  Breakpoint 6, redisplay_internal ()
      at /data/steve/bzr/emacs/quickfixes/src/xdisp.c:12669
  12669     struct window *w = XWINDOW (selected_window);

I guess the four windows are the two vertically deployed windows (one of
which was deleted at the beginning) displaying the buffer in which I
typed "test" on line 2 + the window displaying the minibuffer + the root
window; is this right?  Why do they all show mouse_face_overwritten_p =
0 at line 1 and how can I tell which one contained the highlighted text?

Steve Berman