GNU bug report logs - #50798
28.0.50; Tab line close button is off-center until it is highlighted with the mouse

Previous Next

Package: emacs;

Reported by: Po Lu <luangruo <at> yahoo.com>

Date: Sat, 25 Sep 2021 06:55:02 UTC

Severity: normal

Found in version 28.0.50

Fixed in version 28.0.60

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: luangruo <at> yahoo.com, larsi <at> gnus.org, 50798 <at> debbugs.gnu.org
Subject: Re: 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 <at> linkov.net>
> Cc: larsi <at> gnus.org,  luangruo <at> yahoo.com,  50798 <at> 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?




This bug report was last modified 3 years and 227 days ago.

Previous Next


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