summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2022-05-04 22:32:30 +0300
committerJuri Linkov <juri@linkov.net>2022-05-04 22:32:30 +0300
commit78df8a0e3d3cce35fbcc972a62200a9da506a0a1 (patch)
tree55d43f081f28ee8165cdb4c650b12c7c02873b2f
parente88d91b1d2f94b21bd5560670c575069164aff05 (diff)
downloademacs-78df8a0e3d3cce35fbcc972a62200a9da506a0a1.tar.gz
* lisp/tab-bar.el: Use pixel-based alignment (bug#55207)
* lisp/tab-bar.el (tab-bar-format-align-right): Use string-pixel-width on the string with tab-bar face to get the width in pixels to align. (tab-bar-format-global): Remove string-trim-right to keep padding-right.
-rw-r--r--lisp/tab-bar.el6
1 files changed, 3 insertions, 3 deletions
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index a0dd20a99ca..42c4b822bc6 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -915,8 +915,8 @@ when the tab is current. Return the result as a keymap."
(let* ((rest (cdr (memq 'tab-bar-format-align-right tab-bar-format)))
(rest (tab-bar-format-list rest))
(rest (mapconcat (lambda (item) (nth 2 item)) rest ""))
- (hpos (length rest))
- (str (propertize " " 'display `(space :align-to (- right ,hpos)))))
+ (hpos (string-pixel-width (propertize rest 'face 'tab-bar)))
+ (str (propertize " " 'display `(space :align-to (- right (,hpos))))))
`((align-right menu-item ,str ignore))))
(defun tab-bar-format-global ()
@@ -926,7 +926,7 @@ When `tab-bar-format-global' is added to `tab-bar-format'
then modes that display information on the mode line
using `global-mode-string' will display the same text
on the tab bar instead."
- `((global menu-item ,(string-trim-right (format-mode-line global-mode-string)) ignore)))
+ `((global menu-item ,(format-mode-line global-mode-string) ignore)))
(defun tab-bar-format-list (format-list)
(let ((i 0))