GNU bug report logs - #76394
mouse-face property not working in tab-bar

Previous Next

Package: emacs;

Reported by: Ship Mints <shipmints <at> gmail.com>

Date: Tue, 18 Feb 2025 15:05:02 UTC

Severity: normal

Tags: patch

Full log


Message #41 received at 76394 <at> debbugs.gnu.org (full text, mbox):

From: Ship Mints <shipmints <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 76394 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#76394: mouse-face property not working in tab-bar
Date: Fri, 28 Feb 2025 11:20:31 -0500
[Message part 1 (text/plain, inline)]
On Thu, Feb 27, 2025 at 3:15 PM Eli Zaretskii <eliz <at> gnu.org> wrote:

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

I tried.  I hope the revised log is acceptable.

Modeled after Juri's 24c4bc1:

* src/xdisp.c (note_tab_bar_highlight): Remove fallback for
help_echo_string.
Don't use TAB_BAR_ITEM_CAPTION as the default value
when TAB_BAR_ITEM_HELP is not specified (bug#73050).

And Eli's 1136963:

; * src/xdisp.c (maybe_produce_line_number): Fix last change (bug#76362).

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

I had a misconfiguration of tree sitter for C/C++ that borked the mode to
not match .dir-locals.  I fixed that.

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

Done.


> > +          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'?
>

I wasn't sure remaps were valid in tab_bar.  I put w in now, just in case
they are.

> +       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?
>

There's a comment in display_tab_bar:

  /* FIXME: This should be controlled by a user option.  See the
     comments in redisplay_tool_bar and display_mode_line about
     this.  */
  it.paragraph_embedding = L2R;

I figured let's be defensive for when this is implemented.

Also added tab-bar-tab-highlight face in lisp/tab-bar.el.

-Stephane
[Message part 2 (text/html, inline)]
[0001-mouse-face-properties-on-tab-bar-tab-captions-bug-76.patch (application/octet-stream, attachment)]

This bug report was last modified 101 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.