Subject: Re: bug#50798: 28.0.50; Tab line close button is off-center until it is highlighted with the mouse

From: Eli Zaretskii <[email-masked]>
Date: Sat, 02 Oct 2021 13:08:36 +0300

> From: Juri Linkov <[email-masked]>
> Cc: [email-masked],  [email-masked],  [email-masked]
> Date: Tue, 28 Sep 2021 21:46:28 +0300
> 
> >> The problem is that hovering mouse over the text property 'mouse-face'
> >> set to 'tab-line-highlight' that contains ':inherit' applies its face
> >> attributes such as :box :line-width twice thus shifting the image upwards.
> >
> > Sounds like a potential bug.  Hod did you see that these attributes
> > were applied twice?  And why applying the same attribute twice causes
> > effects that are different from applying it once?
> 
> It was a guess that it's applied twice.  Maybe there is another bug.
> At looked at the depths of 'note_mode_line_or_margin_highlight',
> but don't understand what is wrong.  Some X coords are miscalculated
> when the mouse-face is inherited from the face with with :line-width 1.

Please tell more about what you saw there.  Which X coordinates are
miscalculated?

And I don't think I understand the arrangement with faces for the
close button.  tab-line.el says:

  (defvar tab-line-close-button
    (propertize " x"
		'display '(image :type xpm
				 :file "tabs/close.xpm"
				 :margin (2 . 0)
				 :ascent center)
		'keymap tab-line-tab-close-map
		'mouse-face 'tab-line-close-highlight
		'help-echo "Click to close tab")
    "Button for closing the clicked tab.")

which seems to mean we should use 'tab-line-close-highlight' as the
mouse-face for this button.  But if I invoke (tab-line-format), which
seems to be what calculates the tab-line-format, I see this:

(#(" xdisp.c x"
 1 8
   (tab #<buffer xdisp.c>
    face tab-line-tab-inactive
    mouse-face tab-line-highlight
    keymap (keymap (13 . tab-line-select-tab)
                   (tab-line keymap (down-mouse-3 . tab-line-tab-context-menu)
                                    (mouse-2 . tab-line-close-tab)
                                    (down-mouse-1 . tab-line-select-tab)))
           follow-link ignore)
 8 10
   (tab #<buffer xdisp.c>
    face tab-line-tab-inactive
    display (image :type xpm :file "tabs/close.xpm" :margin (2 . 0) :ascent center)
    keymap (keymap (tab-line keymap (mouse-2 . tab-line-close-tab)
                                    (mouse-1 . tab-line-close-tab)))
    mouse-face tab-line-highlight ...

which seems to say we actually use the 'tab-line-highlight' face
instead for the close button?

Could you please describe how mouse-highlight faces are supposed to
work with tab-line close buttons, and preferably walk me through the
relevant code?