GNU bug report logs - #56874
28.1.50; tab-bar-format-align-right should probably use string-width

Previous Next

Package: emacs;

Reported by: Adam Porter <adam <at> alphapapa.net>

Date: Mon, 1 Aug 2022 16:50:02 UTC

Severity: minor

Tags: moreinfo

Found in version 28.1.50

Fixed in version 29.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 56874 in the body.
You can then email your comments to 56874 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#56874; Package emacs. (Mon, 01 Aug 2022 16:50:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Adam Porter <adam <at> alphapapa.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 01 Aug 2022 16:50:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Adam Porter <adam <at> alphapapa.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.1.50; tab-bar-format-align-right should probably use string-width
Date: Mon, 1 Aug 2022 11:49:19 -0500
Hi Juri, et al,

I noticed that, when I added a mode line construct to global-mode-line 
and enabled the display of such in the tab line (using 
tab-bar-format-align-right, etc.), the construct wrapped onto a second 
line in the tab bar.  I looked at the source code of 
tab-bar-format-align-right and noticed that it uses length instead of 
string-width.  I changed it to string-width and it fixed the problem.

Note that a similar problem remains: if the tab-bar face has, for 
example, a larger height than the default face, the width will still be 
incorrectly calculated, causing wrapping onto a new line.  I don't know 
how to fix that, since window-text-pixel-size requires a buffer and a 
window.

But this is an improvement, anyway.

Thanks,
Adam




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56874; Package emacs. (Mon, 01 Aug 2022 18:18:03 GMT) Full text and rfc822 format available.

Message #8 received at 56874 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Adam Porter <adam <at> alphapapa.net>
Cc: 56874 <at> debbugs.gnu.org
Subject: Re: bug#56874: 28.1.50; tab-bar-format-align-right should probably
 use string-width
Date: Mon, 01 Aug 2022 21:13:43 +0300
> I noticed that, when I added a mode line construct to global-mode-line and
> enabled the display of such in the tab line (using
> tab-bar-format-align-right, etc.), the construct wrapped onto a second line
> in the tab bar.  I looked at the source code of tab-bar-format-align-right
> and noticed that it uses length instead of string-width.  I changed it to
> string-width and it fixed the problem.
>
> Note that a similar problem remains: if the tab-bar face has, for example,
> a larger height than the default face, the width will still be incorrectly
> calculated, causing wrapping onto a new line.  I don't know how to fix
> that, since window-text-pixel-size requires a buffer and a window.
>
> But this is an improvement, anyway.

Please check Emacs 29 where tab-bar-format-align-right
contains a better improvement:

  (string-pixel-width (propertize rest 'face 'tab-bar))

Does this work in your case as well?




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 02 Aug 2022 10:19:01 GMT) Full text and rfc822 format available.

Severity set to 'minor' from 'normal' Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Thu, 04 Aug 2022 13:59:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56874; Package emacs. (Fri, 05 Aug 2022 20:33:02 GMT) Full text and rfc822 format available.

Message #15 received at 56874 <at> debbugs.gnu.org (full text, mbox):

From: Adam Porter <adam <at> alphapapa.net>
To: Juri Linkov <juri <at> linkov.net>
Cc: 56874 <at> debbugs.gnu.org
Subject: Re: bug#56874: 28.1.50; tab-bar-format-align-right should probably
 use string-width
Date: Fri, 5 Aug 2022 15:32:35 -0500
Hi Juri,

On 8/1/22 13:13, Juri Linkov wrote:

> Please check Emacs 29 where tab-bar-format-align-right
> contains a better improvement:
> 
>    (string-pixel-width (propertize rest 'face 'tab-bar))
> 
> Does this work in your case as well?

I don't have an Emacs 29 build readily accessible, but I see that Emacs 
28 has the function `shr-string-pixel-width', which I'm guessing is 
similar.  So I tried using that function, and it is an improvement, but 
not quite correct: rather than wrapping onto a new line, the string 
appears on the same line as the rest of the tab-bar, but it is not 
right-aligned as it should be.

If it would help you reproduce the problem to test whether Emacs 29 
already has a fix, all that seems to be necessary is to set the tab-bar 
face to, e.g. ":height 1.2", and add a string of some length (e.g. about 
20) to the global-mode-string, and see whether it wraps onto a new line 
and whether it's right-aligned.  If it seems correct on Emacs 29, then 
I'd guess it's already solved.

Thanks,
Adam




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56874; Package emacs. (Mon, 08 Aug 2022 17:24:02 GMT) Full text and rfc822 format available.

Message #18 received at 56874 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Adam Porter <adam <at> alphapapa.net>
Cc: 56874 <at> debbugs.gnu.org
Subject: Re: bug#56874: 28.1.50; tab-bar-format-align-right should probably
 use string-width
Date: Mon, 08 Aug 2022 20:11:09 +0300
close 56874 29.0.50
thanks

Hi Adam,

> If it would help you reproduce the problem to test whether Emacs 29 already
> has a fix, all that seems to be necessary is to set the tab-bar face to,
> e.g. ":height 1.2", and add a string of some length (e.g. about 20) to the
> global-mode-string, and see whether it wraps onto a new line and whether
> it's right-aligned.  If it seems correct on Emacs 29, then I'd guess it's
> already solved.

Thanks for the test case.  I tried it in Emacs 29, and everything looks nice,
so I'm closing this bug report.




bug marked as fixed in version 29.0.50, send any further explanations to 56874 <at> debbugs.gnu.org and Adam Porter <adam <at> alphapapa.net> Request was from Juri Linkov <juri <at> linkov.net> to control <at> debbugs.gnu.org. (Mon, 08 Aug 2022 17:24:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 06 Sep 2022 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 290 days ago.

Previous Next


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