summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2022-11-05 19:15:42 +0200
committerJuri Linkov <juri@linkov.net>2022-11-05 19:15:42 +0200
commit2637ef8f48a9f1bd26575731465b9ce0e75d4653 (patch)
tree382347f5b44f50a063aff4a5cac0dcf96a56cc48
parent270020a4b45edb0484a9e7b40ec2fbd894cb430d (diff)
downloademacs-2637ef8f48a9f1bd26575731465b9ce0e75d4653.tar.gz
* lisp/tab-bar.el (tab-bar-fixed-width): Improve width calculations.
-rw-r--r--lisp/tab-bar.el7
1 files changed, 4 insertions, 3 deletions
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 810cb4edd7f..2150fa15065 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -1055,9 +1055,10 @@ tab bar might wrap to the second line.")
(propertize name 'face 'tab-bar-tab))))
(cond
((< pixel-width width)
- (let ((space (apply 'propertize " " (text-properties-at 0 name)))
- (ins-pos (- len (if close-p 1 0))))
- (while (< pixel-width width)
+ (let* ((space (apply 'propertize " " (text-properties-at 0 name)))
+ (space-width (string-pixel-width (propertize space 'face 'tab-bar)))
+ (ins-pos (- len (if close-p 1 0))))
+ (while (<= (+ pixel-width space-width) width)
(setf (substring name ins-pos ins-pos) space)
(setq pixel-width (string-pixel-width
(propertize name 'face 'tab-bar-tab))))))