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: Juri Linkov
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 19:51:40 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu)

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

It's possible to put properties on the close button only, but wouldn't this be
too ugly?  This means that hovering the mouse over the tab name will highlight 
only
the tab name without highlighting the close button.  And hovering the mouse
over the close button will highlight only the close button without highlighting
the tab name.  So highlighting will be separate for the close button and
the rest of the tab with such patch:

diff --git a/lisp/tab-line.el b/lisp/tab-line.el
index 4a751b384e..daaa5531ef 100644
--- a/lisp/tab-line.el
+++ b/lisp/tab-line.el
@@ -125,7 +125,11 @@ tab-line-highlight
   :group 'tab-line-faces)
 
 (defface tab-line-close-highlight
-  '((t :foreground "red"))
+  '((((class color) (min-colors 88))
+     :box (:line-width 1 :style released-button)
+     :background "grey85"
+     :foreground "black")
+    (t :inverse-video nil))
   "Tab line face for highlighting of the close button."
   :version "27.1"
   :group 'tab-line-faces)
@@ -481,22 +485,23 @@ tab-line-tab-name-format-default
                  'tab-line-tab-inactive)))
     (dolist (fn tab-line-tab-face-functions)
       (setf face (funcall fn tab tabs face buffer-p selected-p)))
-    (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))))
+    (concat
+     (apply 'propertize name
+            `(
+              tab ,tab
+              ,@(if selected-p '(selected t))
+              face ,face
+              mouse-face tab-line-highlight
+              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)))
+              (propertize tab-line-close-button 'face face))
+         ""))))
 
 (defun tab-line-format-template (tabs)
   "Template for displaying tab line for selected window."

reply via email to

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