bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#50798: 28.0.50; Tab line close button is off-center until it is high


From: Eli Zaretskii
Subject: bug#50798: 28.0.50; Tab line close button is off-center until it is highlighted with the mouse
Date: Sun, 03 Oct 2021 14:49:07 +0300

> From: Juri Linkov <juri@linkov.net>
> Cc: larsi@gnus.org,  luangruo@yahoo.com,  50798@debbugs.gnu.org
> Date: Sat, 02 Oct 2021 22:36:15 +0300
> 
> >   (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
> >     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)
> >     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?
> 
> 'tab-line-close-highlight' was supposed to be applied to the close button
> to emulate how the close button behaves on the tab bar where hovering mouse
> over the button displays it with the face style 'released-button'.
> 
> But mouse-face of the face 'tab-line-highlight' overrides the mouse-face
> 'tab-line-close-highlight' in 'tab-line-tab-name-format-default'
> that applies 'propertize' with 'mouse-face tab-line-highlight'.
> And I can't find a way how to keep the existing 'mouse-face' property on
> the close button while applying 'mouse-face tab-line-highlight' to the
> rest of the tab.

I'm not sure I follow: it is your code in
tab-line-tab-name-format-default that applies the tab-line-highlight
as mouse-face to the button:

    (apply 'propertize
           (concat (propertize name
                               'keymap tab-line-tab-map
                               ;; Don't turn mouse-1 into mouse-2 (bug#49247)
                               'follow-link 'ignore)
                   (or (and (or buffer-p (assq 'buffer tab) (assq 'close tab))
                            tab-line-close-button-show
                            (not (eq tab-line-close-button-show
                                     (if selected-p 'non-selected 'selected)))
                            tab-line-close-button)
                       ""))
           `(
             tab ,tab
             ,@(if selected-p '(selected t))
             face ,face
             mouse-face tab-line-highlight))))

You should be able not to do that for the close button.  Or am I
missing something?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]