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

From: Eli Zaretskii <[email-masked]>
Date: Mon, 01 Jul 2024 14:36:06 +0300

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

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.

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