Commit a7289c04 authored by Juri Linkov's avatar Juri Linkov

* lisp/tab-bar.el (tab-bar-make-keymap-1): Don't use fixed "Current tab".

* lisp/tab-bar.el (tab-bar-make-keymap-1):
* lisp/tab-line.el (tab-line-tab-name-add):
Add space after Unicode char to avoid char clobbering on terminals.
parent 2a016475
Pipeline #3075 passed with stage
in 55 minutes and 38 seconds
......@@ -171,6 +171,16 @@ Return its existing value or a new value."
(defun tab-bar-make-keymap-1 ()
"Generate an actual keymap from `tab-bar-map', without caching."
;; Can't check for char-displayable-p in defvar
;; because this file is preloaded.
(unless tab-bar-tab-name-add
(setq tab-bar-tab-name-add
(if (char-displayable-p ?) "➕" "[+]")))
(unless tab-bar-tab-name-close
(setq tab-bar-tab-name-close
;; Need to add space after Unicode char on terminals
;; to avoid clobbering next char by wide Unicode char.
(if (char-displayable-p ?⮿) (if window-system "⮿" "⮿ ") "[x]")))
(let ((i 0))
(append
'(keymap (mouse-1 . tab-bar-mouse))
......@@ -181,7 +191,7 @@ Return its existing value or a new value."
((eq (car tab) 'current-tab)
`(current-tab
menu-item
,(propertize "Current tab" 'face 'tab-bar-tab)
,(propertize (cdr (assq 'name tab)) 'face 'tab-bar-tab)
ignore
:help "Current tab"))
(t
......@@ -194,8 +204,7 @@ Return its existing value or a new value."
:help "Click to visit tab")))
`(,(intern (format "close-tab-%i" i))
menu-item
,(concat (propertize (or tab-bar-tab-name-close
(if (char-displayable-p ?⮿) "⮿" "[x]"))
,(concat (propertize tab-bar-tab-name-close
'face (if (eq (car tab) 'current-tab)
'tab-bar-tab
'tab-bar-tab-inactive))
......@@ -206,8 +215,7 @@ Return its existing value or a new value."
:help "Click to close tab")))
(tab-bar-tabs))
`((add-tab menu-item
,(propertize (or tab-bar-tab-name-add
(if (char-displayable-p ?) "➕" "[+]"))
,(propertize tab-bar-tab-name-add
'face 'tab-bar-tab-inactive)
tab-bar-add-tab
:help "Click to add tab")))))
......
......@@ -113,9 +113,14 @@
"Local keymap to close `tab-line-mode' window tabs.")
(defvar tab-line-separator " ")
(defvar tab-line-tab-name-ellipsis (if (char-displayable-p ?) "…" "..."))
(defvar tab-line-tab-name-add (if (char-displayable-p ?) "➕" "[+]"))
(defvar tab-line-tab-name-close (if (char-displayable-p ?⮿) "⮿" "[x]"))
(defvar tab-line-tab-name-ellipsis
(if (char-displayable-p ?) "…" "..."))
(defvar tab-line-tab-name-add
(if (char-displayable-p ?) "➕" "[+]"))
(defvar tab-line-tab-name-close
;; Need to add space after Unicode char on terminals
;; to avoid clobbering next char by wide Unicode char.
(if (char-displayable-p ?⮿) (if window-system "⮿" "⮿ ") "[x]"))
(defun tab-line-tab-name (buffer &optional buffers)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment