bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#55207: 29.0.50; tab-bar-format-align-right only works correctly with


From: Juri Linkov
Subject: bug#55207: 29.0.50; tab-bar-format-align-right only works correctly with monospace characters
Date: Tue, 03 May 2022 20:52:17 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu)

> Hopefully this information proves useful, thank you for looking into
> this.

Thanks, this helped to realize that the pixel width should be calculated
with the same face that is really used on the tab bar.  Could you please
try a new patch.  At least, I see that it works with your test cases.

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 03b49e9657..4d5ec4098c 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -915,8 +915,8 @@ tab-bar-format-align-right
   (let* ((rest (cdr (memq 'tab-bar-format-align-right tab-bar-format)))
          (rest (tab-bar-format-list rest))
          (rest (mapconcat (lambda (item) (nth 2 item)) rest ""))
-         (hpos (length rest))
-         (str (propertize " " 'display `(space :align-to (- right ,hpos)))))
+         (hpos (string-pixel-width (propertize rest 'face 'tab-bar)))
+         (str (propertize " " 'display `(space :align-to (- right (,hpos))))))
     `((align-right menu-item ,str ignore))))





reply via email to

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