From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs 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 Organization: LINKOV.NET Message-ID: <86r15ddsh1.fsf@mail.linkov.net> References: <87y1zli75x.fsf@dsemy.com> <86levlf880.fsf@mail.linkov.net> <87bkwhdtd4.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36088"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) Cc: 55207@debbugs.gnu.org, daniel@dsemy.com To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun May 01 20:23:22 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nlEE6-0009G0-39 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 01 May 2022 20:23:22 +0200 Original-Received: from localhost ([::1]:45018 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nlEE4-0005Ph-Ij for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 01 May 2022 14:23:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38300) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlEDm-0005PV-Mr for bug-gnu-emacs@gnu.org; Sun, 01 May 2022 14:23:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40261) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nlEDm-0001fv-DK for bug-gnu-emacs@gnu.org; Sun, 01 May 2022 14:23:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nlEDm-0003XL-9m for bug-gnu-emacs@gnu.org; Sun, 01 May 2022 14:23:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 01 May 2022 18:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55207 X-GNU-PR-Package: emacs Original-Received: via spool by 55207-submit@debbugs.gnu.org id=B55207.165142932513496 (code B ref 55207); Sun, 01 May 2022 18:23:02 +0000 Original-Received: (at 55207) by debbugs.gnu.org; 1 May 2022 18:22:05 +0000 Original-Received: from localhost ([127.0.0.1]:34154 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nlECr-0003Vc-Ag for submit@debbugs.gnu.org; Sun, 01 May 2022 14:22:05 -0400 Original-Received: from relay2-d.mail.gandi.net ([217.70.183.194]:54413) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nlECo-0003V6-K4 for 55207@debbugs.gnu.org; Sun, 01 May 2022 14:22:03 -0400 Original-Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id D127640003; Sun, 1 May 2022 18:21:54 +0000 (UTC) In-Reply-To: <87bkwhdtd4.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sun, 01 May 2022 20:01:59 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:231187 Archived-At: > 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))))