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

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

> From: Stephen Berman <[email-masked]>
> Cc: [email-masked],  [email-masked],  [email-masked]
> Date: Tue, 09 May 2023 12:35:35 +0200
> 
> > OK, thanks.  This is still OK, so please do this with the new
> > breakpoint as described in my other email.  It would be interesting to
> > see the difference between fundamental-mode and lisp-interaction-mode
> > with that second breakpoint.
> 
> lisp-interaction-mode:
> 
> Thread 1 "emacs" hit Breakpoint 3, x_set_glyph_string_gc (
>     s=s@entry=0x7fffffffc610)
>     at /home/steve/src/emacs/emacs-29/src/xterm.c:8119
> 8119	      x_set_mouse_face_gc (s);
> (gdb) print *s
> $1 = {
>   x = 16,
>   y = 51,
>   ybase = 64,
>   width = 40,
>   background_width = 633,
>   height = 17,
>   left_overhang = 0,
>   right_overhang = 0,
>   f = 0x55555611ef10,
>   w = 0x55555611f160,
>   row = 0x5555566bac90,
>   area = TEXT_AREA,
>   char2b = 0x7fffffffc5f0,
>   nchars = 5,
>   hl = DRAW_MOUSE_FACE,
>   face = 0x5555568e1310,
>   font = 0x55555603c258,
>   cmp = 0x0,
>   cmp_id = 0,
>   cmp_from = 0,
>   cmp_to = 0,
>   extends_to_end_of_line_p = true,
>   background_filled_p = false,
>   font_not_found_p = false,
>   stippled_p = false,
>   for_overlaps = 0,
>   padding_p = false,
>   gc = 0x0,
>   first_glyph = 0x55555626a030,
>   img = 0x0,
>   xwidget = 0x0,
>   slice = {
>     x = 0,
>     y = 0,
>     width = 0,
>     height = 0
>   },
>   clip_head = 0x0,
>   clip_tail = 0x0,
>   clip = {{
>       x = 0,
>       y = 0,
>       width = 0,
>       height = 0
>     }, {
>       x = 0,
>       y = 0,
>       width = 0,
>       height = 0
>     }},
>   num_clips = 0,
>   underline_position = 0,
>   underline_thickness = 0,
>   next = 0x0,
>   prev = 0x0
> }
> (gdb) print s->first_glyph - s->row->glyphs[1]
> $2 = 1
> (gdb) continue
> Continuing.
> 
> Thread 1 "emacs" hit Breakpoint 3, x_set_glyph_string_gc (
>     s=s@entry=0x7fffffffc610)
>     at /home/steve/src/emacs/emacs-29/src/xterm.c:8119
> 8119	      x_set_mouse_face_gc (s);
> (gdb) print *s
> $3 = {
>   x = 16,
>   y = 51,
>   ybase = 64,
>   width = 40,
>   background_width = 633,
>   height = 17,
>   left_overhang = 0,
>   right_overhang = 0,
>   f = 0x55555611ef10,
>   w = 0x55555611f160,
>   row = 0x5555566bac90,
>   area = TEXT_AREA,
>   char2b = 0x7fffffffc5f0,
>   nchars = 5,
>   hl = DRAW_MOUSE_FACE,
>   face = 0x5555568e1310,
>   font = 0x55555603c258,
>   cmp = 0x0,
>   cmp_id = 0,
>   cmp_from = 0,
>   cmp_to = 0,
>   extends_to_end_of_line_p = true,
>   background_filled_p = false,
>   font_not_found_p = false,
>   stippled_p = false,
>   for_overlaps = 0,
>   padding_p = false,
>   gc = 0x0,
>   first_glyph = 0x55555626a030,
>   img = 0x0,
>   xwidget = 0x0,
>   slice = {
>     x = 0,
>     y = 0,
>     width = 0,
>     height = 0
>   },
>   clip_head = 0x0,
>   clip_tail = 0x0,
>   clip = {{
>       x = 0,
>       y = 0,
>       width = 0,
>       height = 0
>     }, {
>       x = 0,
>       y = 0,
>       width = 0,
>       height = 0
>     }},
>   num_clips = 0,
>   underline_position = 0,
>   underline_thickness = 0,
>   next = 0x0,
>   prev = 0x0
> }
> (gdb) print s->first_glyph - s->row->glyphs[1]
> $4 = 1
> (gdb) continue
> Continuing.
> 
> Thread 1 "emacs" hit Breakpoint 3, x_set_glyph_string_gc (
>     s=s@entry=0x7fffffffc740)
>     at /home/steve/src/emacs/emacs-29/src/xterm.c:8119
> 8119	      x_set_mouse_face_gc (s);
> (gdb) print *s
> $5 = {
>   x = 16,
>   y = 51,
>   ybase = 64,
>   width = 40,
>   background_width = 633,
>   height = 17,
>   left_overhang = 0,
>   right_overhang = 0,
>   f = 0x55555611ef10,
>   w = 0x55555611f160,
>   row = 0x5555566bac90,
>   area = TEXT_AREA,
>   char2b = 0x7fffffffc720,
>   nchars = 5,
>   hl = DRAW_MOUSE_FACE,
>   face = 0x5555568e1310,
>   font = 0x55555603c258,
>   cmp = 0x0,
>   cmp_id = 0,
>   cmp_from = 0,
>   cmp_to = 0,
>   extends_to_end_of_line_p = true,
>   background_filled_p = false,
>   font_not_found_p = false,
>   stippled_p = false,
>   for_overlaps = 0,
>   padding_p = false,
>   gc = 0x0,
>   first_glyph = 0x55555626a030,
>   img = 0x0,
>   xwidget = 0x0,
>   slice = {
>     x = 0,
>     y = 0,
>     width = 0,
>     height = 0
>   },
>   clip_head = 0x0,
>   clip_tail = 0x0,
>   clip = {{
>       x = 0,
>       y = 0,
>       width = 0,
>       height = 0
>     }, {
>       x = 0,
>       y = 0,
>       width = 0,
>       height = 0
>     }},
>   num_clips = 0,
>   underline_position = 0,
>   underline_thickness = 0,
>   next = 0x0,
>   prev = 0x0
> }
> (gdb) print s->first_glyph - s->row->glyphs[1]
> $6 = 1
> 
> ============================================
> fundamental-mode:
> 
> Thread 1 "emacs" hit Breakpoint 3, x_set_glyph_string_gc (
>     s=s@entry=0x7fffffffc610)
>     at /home/steve/src/emacs/emacs-29/src/xterm.c:8119
> 8119	      x_set_mouse_face_gc (s);
> (gdb) print *s
> $1 = {
>   x = 16,
>   y = 0,
>   ybase = 13,
>   width = 38,
>   background_width = 38,
>   height = 17,
>   left_overhang = 1,
>   right_overhang = 0,
>   f = 0x5555560f8190,
>   w = 0x5555560f83e0,
>   row = 0x5555566c4920,
>   area = TEXT_AREA,
>   char2b = 0x7fffffffc5f0,
>   nchars = 4,
>   hl = DRAW_MOUSE_FACE,
>   face = 0x5555561e69d0,
>   font = 0x5555565ece88,
>   cmp = 0x0,
>   cmp_id = 0,
>   cmp_from = 0,
>   cmp_to = 0,
>   extends_to_end_of_line_p = false,
>   background_filled_p = true,
>   font_not_found_p = false,
>   stippled_p = false,
>   for_overlaps = 0,
>   padding_p = false,
>   gc = 0x55555681ba10,
>   first_glyph = 0x5555565c17e0,
>   img = 0x0,
>   xwidget = 0x0,
>   slice = {
>     x = 0,
>     y = 0,
>     width = 0,
>     height = 0
>   },
>   clip_head = 0x7fffffffc610,
>   clip_tail = 0x0,
>   clip = {{
>       x = 8,
>       y = 0,
>       width = 8,
>       height = 17
>     }, {
>       x = 0,
>       y = 0,
>       width = 0,
>       height = 0
>     }},
>   num_clips = 0,
>   underline_position = 0,
>   underline_thickness = 0,
>   next = 0x7fffffffc500,
>   prev = 0x7fffffffc400
> }
> (gdb) print s->first_glyph - s->row->glyphs[1]
> $2 = 1
> (gdb) continue
> Continuing.
> 
> Thread 1 "emacs" hit Breakpoint 3, x_set_glyph_string_gc (
>     s=s@entry=0x7fffffffc500)
>     at /home/steve/src/emacs/emacs-29/src/xterm.c:8119
> 8119	      x_set_mouse_face_gc (s);
> (gdb) print *s
> $3 = {
>   x = 54,
>   y = 0,
>   ybase = 13,
>   width = 8,
>   background_width = 595,
>   height = 17,
>   left_overhang = 0,
>   right_overhang = 0,
>   f = 0x5555560f8190,
>   w = 0x5555560f83e0,
>   row = 0x5555566c4920,
>   area = TEXT_AREA,
>   char2b = 0x7fffffffc4f0,
>   nchars = 1,
>   hl = DRAW_MOUSE_FACE,
>   face = 0x5555561e69d0,
>   font = 0x55555615b778,
>   cmp = 0x0,
>   cmp_id = 0,
>   cmp_from = 0,
>   cmp_to = 0,
>   extends_to_end_of_line_p = true,
>   background_filled_p = false,
>   font_not_found_p = false,
>   stippled_p = false,
>   for_overlaps = 0,
>   padding_p = false,
>   gc = 0x0,
>   first_glyph = 0x5555565c18a0,
>   img = 0x0,
>   xwidget = 0x0,
>   slice = {
>     x = 0,
>     y = 0,
>     width = 0,
>     height = 0
>   },
>   clip_head = 0x7fffffffc610,
>   clip_tail = 0x0,
>   clip = {{
>       x = 0,
>       y = 0,
>       width = 0,
>       height = 0
>     }, {
>       x = 0,
>       y = 0,
>       width = 0,
>       height = 0
>     }},
>   num_clips = 0,
>   underline_position = 0,
>   underline_thickness = 0,
>   next = 0x0,
>   prev = 0x7fffffffc610
> }
> (gdb) print s->first_glyph - s->row->glyphs[1]
> $4 = 5
> (gdb) continue
> Continuing.
> 
> Thread 1 "emacs" hit Breakpoint 3, x_set_glyph_string_gc (
>     s=s@entry=0x7fffffffc740)
>     at /home/steve/src/emacs/emacs-29/src/xterm.c:8119
> 8119	      x_set_mouse_face_gc (s);
> (gdb) print *s
> $5 = {
>   x = 16,
>   y = 0,
>   ybase = 13,
>   width = 38,
>   background_width = 38,
>   height = 17,
>   left_overhang = 1,
>   right_overhang = 0,
>   f = 0x5555560f8190,
>   w = 0x5555560f83e0,
>   row = 0x5555566c4920,
>   area = TEXT_AREA,
>   char2b = 0x7fffffffc720,
>   nchars = 4,
>   hl = DRAW_MOUSE_FACE,
>   face = 0x5555561e69d0,
>   font = 0x5555565ece88,
>   cmp = 0x0,
>   cmp_id = 0,
>   cmp_from = 0,
>   cmp_to = 0,
>   extends_to_end_of_line_p = false,
>   background_filled_p = true,
>   font_not_found_p = false,
>   stippled_p = false,
>   for_overlaps = 0,
>   padding_p = false,
>   gc = 0x55555681ba10,
>   first_glyph = 0x5555565c17e0,
>   img = 0x0,
>   xwidget = 0x0,
>   slice = {
>     x = 0,
>     y = 0,
>     width = 0,
>     height = 0
>   },
>   clip_head = 0x7fffffffc740,
>   clip_tail = 0x0,
>   clip = {{
>       x = 8,
>       y = 0,
>       width = 8,
>       height = 17
>     }, {
>       x = 0,
>       y = 0,
>       width = 0,
>       height = 0
>     }},
>   num_clips = 0,
>   underline_position = 0,
>   underline_thickness = 0,
>   next = 0x7fffffffc630,
>   prev = 0x7fffffffc530
> }
> (gdb) print s->first_glyph - s->row->glyphs[1]
> $6 = 1
> (gdb) continue
> Continuing.
> 
> Thread 1 "emacs" hit Breakpoint 3, x_set_glyph_string_gc (
>     s=s@entry=0x7fffffffc630)
>     at /home/steve/src/emacs/emacs-29/src/xterm.c:8119
> 8119	      x_set_mouse_face_gc (s);
> (gdb) print *s
> $7 = {
>   x = 54,
>   y = 0,
>   ybase = 13,
>   width = 8,
>   background_width = 595,
>   height = 17,
>   left_overhang = 0,
>   right_overhang = 0,
>   f = 0x5555560f8190,
>   w = 0x5555560f83e0,
>   row = 0x5555566c4920,
>   area = TEXT_AREA,
>   char2b = 0x7fffffffc620,
>   nchars = 1,
>   hl = DRAW_MOUSE_FACE,
>   face = 0x5555561e69d0,
>   font = 0x55555615b778,
>   cmp = 0x0,
>   cmp_id = 0,
>   cmp_from = 0,
>   cmp_to = 0,
>   extends_to_end_of_line_p = true,
>   background_filled_p = false,
>   font_not_found_p = false,
>   stippled_p = false,
>   for_overlaps = 0,
>   padding_p = false,
>   gc = 0x0,
>   first_glyph = 0x5555565c18a0,
>   img = 0x0,
>   xwidget = 0x0,
>   slice = {
>     x = 0,
>     y = 0,
>     width = 0,
>     height = 0
>   },
>   clip_head = 0x7fffffffc740,
>   clip_tail = 0x0,
>   clip = {{
>       x = 0,
>       y = 0,
>       width = 0,
>       height = 0
>     }, {
>       x = 0,
>       y = 0,
>       width = 0,
>       height = 0
>     }},
>   num_clips = 0,
>   underline_position = 0,
>   underline_thickness = 0,
>   next = 0x0,
>   prev = 0x7fffffffc740
> }
> (gdb) print s->first_glyph - s->row->glyphs[1]
> $8 = 5

This looks OK to me: it says we display 4 characters in one face and 1
more in another.  Which agrees with pgrow and with what I understand
should happen here: the 4 characters T O D O are displayed using the
font of the variable-pitch face, and the blank space after it is
displayed using the default face.

What do you see on the screen in this case?  Please describe the
visual appearance of each character in the case of fundamental-mode,
and perhaps also show a screenshot of the window as it is displayed
when the mouse-highlight becomes visible during this scenario.

Thanks.