all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 55207@debbugs.gnu.org, daniel@dsemy.com
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	[thread overview]
Message-ID: <86r15ddsh1.fsf@mail.linkov.net> (raw)
In-Reply-To: <87bkwhdtd4.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sun, 01 May 2022 20:01:59 +0200")

> 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	other threads:[~2022-05-01 18:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-01 15:50 bug#55207: 29.0.50; tab-bar-format-align-right only works correctly with monospace characters Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-01 17:55 ` Juri Linkov
2022-05-01 18:01   ` Lars Ingebrigtsen
2022-05-01 18:21     ` Juri Linkov [this message]
2022-05-02 15:25       ` Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-02 19:06         ` Juri Linkov
2022-05-03  7:40           ` Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-03 17:52             ` Juri Linkov
2022-05-04 11:00               ` Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86r15ddsh1.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=55207@debbugs.gnu.org \
    --cc=daniel@dsemy.com \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.