emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 2637ef8f48: * lisp/tab-bar.el (tab-bar-fixed-width): Improve widt


From: Juri Linkov
Subject: master 2637ef8f48: * lisp/tab-bar.el (tab-bar-fixed-width): Improve width calculations.
Date: Sat, 5 Nov 2022 13:16:03 -0400 (EDT)

branch: master
commit 2637ef8f48a9f1bd26575731465b9ce0e75d4653
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>

    * lisp/tab-bar.el (tab-bar-fixed-width): Improve width calculations.
---
 lisp/tab-bar.el | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 810cb4edd7..2150fa1506 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))))))



reply via email to

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