Subject: bug#63271: 29.0.90; broken mouse-face

From: Eli Zaretskii <[email-masked]>
Date: Tue, 09 May 2023 13:14:29 +0300

> From: Stephen Berman <[email-masked]>
> Cc: Juri Linkov <[email-masked]>,  [email-masked],  [email-masked]
> Date: Tue, 09 May 2023 11:49:00 +0200
> 
> Here's what I get:
> 
> Thread 1 "emacs" hit Breakpoint 3, show_mouse_face (
>     hlinfo=hlinfo@entry=0x555556145870, draw=draw@entry=DRAW_MOUSE_FACE)
>     at /home/steve/src/emacs/emacs-29/src/xdisp.c:33519
> 33519		      row->mouse_face_p
> (gdb) pgrow
> TEXT: 6 glyphs
>   0    0: CHAR[ ] pos=146 blev=0,btyp=L w=8 a+d=13+4 MB
>   1    8: CHAR[T] pos=147 blev=0,btyp=L w=8 a+d=13+4 MB
>   2   16: CHAR[O] pos=148 blev=0,btyp=L w=8 a+d=13+4 MB
>   3   24: CHAR[D] pos=149 blev=0,btyp=L w=8 a+d=13+4 MB
>   4   32: CHAR[O] pos=150 blev=0,btyp=L w=8 a+d=13+4 MB
>   5   40: CHAR[ ] pos=0 blev=0,btyp=B w=8 a+d=13+4 MB
> (gdb) continue
> Continuing.
> 
> Thread 1 "emacs" hit Breakpoint 3, show_mouse_face (hlinfo=0x555556145870,
>     draw=draw@entry=DRAW_MOUSE_FACE)
>     at /home/steve/src/emacs/emacs-29/src/xdisp.c:33519
> 33519		      row->mouse_face_p
> (gdb) pgrow
> TEXT: 6 glyphs
>   0    0: CHAR[ ] pos=146 blev=0,btyp=L w=8 a+d=13+4 MB
>   1    8: CHAR[T] pos=147 blev=0,btyp=L w=8 a+d=13+4 MB
>   2   16: CHAR[O] pos=148 blev=0,btyp=L w=8 a+d=13+4 MB
>   3   24: CHAR[D] pos=149 blev=0,btyp=L w=8 a+d=13+4 MB
>   4   32: CHAR[O] pos=150 blev=0,btyp=L w=8 a+d=13+4 MB
>   5   40: CHAR[ ] pos=0 blev=0,btyp=B w=8 a+d=13+4 MB

Thanks, so far so good.

Next experiment:

  $ gdb ./emacs
  [...]
  (gdb) break xterm.c:8119
  (gdb) run -Q

The breakpoint is here:

  else if (s->hl == DRAW_MOUSE_FACE)
    {
      x_set_mouse_face_gc (s);  <<<<<<<<<<<<<<<<<<<<<<<<<<<
      s->stippled_p = s->face->stipple != 0;
    }

Once again, inside Emacs disable blink-cursor-mode and
global-eldoc-mode, then evaluate the recipe:

  M-: (insert " " (propertize "TODO" 'face '(:inherit variable-pitch) 'mouse-face 'highlight)) RET

and move the mouse pointer to "TODO".  Each time it breaks, please
type:

  (gdb) print *s
  (gdb) print s->first_glyph - s->row->glyphs[1]

and show the results.  On my system the glyph_string s includes 5
glyphs (s->nchars = 5), and the last command above prints "1", which
means the first glyph of the glyph_string is the second glyph on its
screen line (since the line starts with a SPC character that doesn't
have the mouse-highlight face).