From 2637ef8f48a9f1bd26575731465b9ce0e75d4653 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Sat, 5 Nov 2022 19:15:42 +0200 Subject: [PATCH] * 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 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)))))) -- 2.39.2