GNU bug report logs - #55207
29.0.50; tab-bar-format-align-right only works correctly with monospace characters

Previous Next

Package: emacs;

Reported by: Daniel Semyonov <daniel <at> dsemy.com>

Date: Sun, 1 May 2022 15:51:02 UTC

Severity: normal

Found in version 29.0.50

Done: Daniel Semyonov <daniel <at> dsemy.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: Daniel Semyonov <daniel <at> dsemy.com>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 55207 <at> debbugs.gnu.org
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
> 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))))




This bug report was last modified 3 years and 79 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.