From: Juri Linkov Date: Sat, 5 Nov 2022 17:15:42 +0000 (+0200) Subject: * lisp/tab-bar.el (tab-bar-fixed-width): Improve width calculations. X-Git-Tag: emacs-29.0.90~1616^2~281 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=2637ef8f48a9f1bd26575731465b9ce0e75d4653;p=emacs.git * lisp/tab-bar.el (tab-bar-fixed-width): Improve width calculations. --- 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))))))