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: Sun, 01 May 2022 21:21:14 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu)

> I am completely unfamiliar with how the tar bar works, but -- can't you
> just measure the widths of the elements with string-pixel-width or the
> like and use that to compute the alignments?

Thanks for the suggestion.  This works quite nicely.
Only a very small amount of pixels are still misaligned.

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 03b49e9657..7896e051ab 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 rest))
+         (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]