Subject: Re: bug#71866: 30.0.50; [macOS] Cursor hiding char behind it with certain theme customization

From: Dmitry Gutov <[email-masked]>
Date: Tue, 2 Jul 2024 04:07:11 +0300

On 01/07/2024 14:36, Eli Zaretskii wrote:
>> Date: Mon, 1 Jul 2024 06:14:28 +0300
>> From: Dmitry Gutov <[email-masked]>
>>
>> Repro script is attached. Disabling blink-cursor-mode is not a
>> hard requirement, but it makes the bug easier to see. The font and face
>> customizations are both necessary.
>>
>> 1. emacs -Q -l nocursor-repro.el
>> 2. Type 'asdasd' (without quotes)
>> 3. Move point to either of the 's' chars
>> 4. Create a new frame with 'C-x 5 2'
>>
>> The character under cursor won't be visible - just a blank cell (the
>> cursor is blank as well). Then I move point with e.g. C-f and it's
>> visible again.
> 
> This is definitely macOS specific.  I cannot reproduce on my system
> (although by some miracle I do have the Cascadia Mono font installed).
> Basically, what happens is that redisplay has some bug in how it draws
> the cursor.  Given all the tricks that redisplay plays on macOS, I'm
> not surprised.

Indeed, it never happens on my Linux system either. Thanks for checking 
anyway.

> On other platforms, the code which draws the cursor is in draw_glyphs,
> called from XXX_draw_window_cursor function (where XXX is the GUI
> backend, in your case probably XXX = ns).  If the same is true on
> macOS, you could try stepping through that code.

I can try following some more detailed instructions. I.e. I can set up a 
breakpoint, but would there be anything to look out for when stepping 
through the code?

BTW, this happens only right after I switch frames. Things start looking 
right again if I simply move point.

>> The face customization is a part of a 3rd party theme (tango-plus).  I'm
>> pretty sure the :inverse-video customization should be a no-op but it
>> isn't. Seems like a subtle bug somewhere. As a user of the theme it's
>> taken me a while to narrow down the problem, so it'd be great if someone
>> could look into it.
> 
> So if inverse-video is not used, the problem goes away?  If so, just
> don't use it.

Yeah, I plan on submitting a patch to that effect to the theme.

But the bug looks odd enough and the same time very stable, that I think 
it's worth investigating.