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

From: Stephen Berman <[email-masked]>
Date: Sat, 24 Mar 2012 22:46:44 +0100

On Sat, 24 Mar 2012 20:32:09 +0200 Eli Zaretskii <[email-masked]> wrote:

>> From: Stephen Berman <[email-masked]>
>> Cc: Eli Zaretskii <[email-masked]>,  [email-masked]
>> Date: Wed, 21 Mar 2012 18:52:42 +0100
>> 
>> On Thu, 22 Mar 2012 00:29:06 +0800 Chong Yidong <[email-masked]> wrote:
>> 
>> > Eli Zaretskii <[email-masked]> writes:
>> >
>> >>> > 1. emacs -q
>> >>> > 2. C-x 2
>> >>> > 3. Put the mouse pointer over one of the links in the splash screen, so
>> >>> > that the link becomes highlighted.
>> >>> > 4. C-x 1
>> >>> > => The highlighting from step 3 disappears
>> >>>
>> >>> > This problem is reliably reproducible, also on earlier builds of Emacs
>> >>> > 24 I have, but not on Emacs 23.1.91 (I don't have 23.2).
>> >>> 
>> >>> I can reproduce it on Windows in Emacs 23.2.90 and also in stock Emacs
>> >>> 23.2 and Emacs 23.1.  I don't have Emacs 23.1.90 anymore to test.
>> >
>> > I can't reproduce this with latest trunk (x86_64-unknown-linux-gnu, GTK+
>> > Version 3.2.0).  Maybe this has been fixed since the bug report?  Eli,
>> > could you check again, since you could reproduce it before?
>> 
>> I just updated from the trunk and rebuilt (GNU Emacs 24.0.94.6
>> (i686-suse-linux-gnu, GTK+ Version 2.24.7) of 2012-03-21 on escher), and
>> I can still reproduce the bug.
>
> I found why this happens.  The lines ("glyph rows") in which some of
> the glyphs are highlighted in mouse face are marked with a special
> flag.  This flag is checked by redisplay, and it tells redisplay that
> when that row is redrawn, its mouse face should be restored.
>
> Now, "C-x 1" calls delete-other-windows-internal, which, as part of
> its job, deletes the glyph matrices of the original window.  With that
> deletion, those flags of the highlighted rows are reset, i.e. the
> information about the highlight stored in the glyph matrix is lost.
> But no one tells redisplay that the mouse highlight was effectively
> overwritten, and that it should arrange for it to be redisplayed.
>
> The patch below fixes that.  

I applied the patch and rebuilt, and confirm it fixes the bug; thanks.

>                              Again, since this isn't a regression wrt
> Emacs 23, I will not install it now unless Chong and Stefan decide I
> should.

According to my observations it is a regression, though I don't know why
your observations differ from mine.  Does your patch also fix Emacs 23
for you?  Since the code involved changed significantly between Emacs 23
and 24, I'm curious if your fix also applies to Emacs 23 -- would it go
before the invocation of free_window_matrices in delete_window?  But if
so, why do I not see the bug in Emacs 23?  (And why does Chong Yidong
not see it in Emacs 24?)

Steve Berman