Subject: bug#76394: mouse-face property not working in tab-bar

From: Eli Zaretskii <[email-masked]>
Date: Thu, 27 Feb 2025 22:14:55 +0200

> Cc: [email-masked]
> From: Ship Mints <[email-masked]>
> Date: Mon, 24 Feb 2025 10:27:11 -0500
> 

> From 13045c1823d81a1f7a2aea2f9e7c81436ce16efa Mon Sep 17 00:00:00 2001
> From: shipmints <[email-masked]>
> Date: Sat, 22 Feb 2025 05:13:05 -0500
> Subject: [PATCH] Handle mouse-face properties on tab-bar tabs (bug#76394)

Thanks, I have a few comments:

> * src/xdisp.c (note_tab_bar_highlight):
> Handle mouse-face properties, if found.  Realize the face if necessary.

Please reformat this log entry according to our conventions (see
examples in Git).

> +      if (STRINGP (string))
> +        {
> +          /* Compute starting column of the tab-bar-item to adjust col
> +             of the mouse face relative to row_start_glyph.
> +
> +             tab_bar_item_info does not contain the absolute starting
> +             offset of the item.  We compute it by looking backwards
> +             until we find a glyph that belongs to a previous tab bar
> +             item, or if this is the first item. */

Please indent with TABs and SPCs, not just with SPCs, per our
conventions for C source files.  (This is supposed to happen
automatically due to our .dir-locals.el, unless you disable that for
some reason.)

> +                break; /* Just before the beginning of this item. */
                                                                   ^^
Please leave two spaces at the end of a comment (here and elsewhere in
the patch).

> +          mouse_face = Fget_text_property (make_fixnum (hpos_caption),
> +                                           Qmouse_face, string);
> +          if (!NILP (mouse_face))
> +            {
> +              mouse_face_id = lookup_named_face (NULL, f, mouse_face, false);
                                                    ^^^^
Why NULL and not 'w'?

> +	  if ( EQ (window, hlinfo->mouse_face_window)
> +	       && (!row->reversed_p

Can a glyph row that corresponds to a tab bar be reversed?  IOW, can
the tab bar be ever displayed right-to-left?  I don't think so, but if
I'm wrong, can you describe a scenario where it can happen?