]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/tab-bar.el (tab-bar-fixed-width): Improve width calculations.
authorJuri Linkov <juri@linkov.net>
Sat, 5 Nov 2022 17:15:42 +0000 (19:15 +0200)
committerJuri Linkov <juri@linkov.net>
Sat, 5 Nov 2022 17:15:42 +0000 (19:15 +0200)
lisp/tab-bar.el

index 810cb4edd7fae06fa79045d999e598a314f97805..2150fa15065de94f9dcac2e927771c893566f39b 100644 (file)
@@ -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))))))