* bug#56874: 28.1.50; tab-bar-format-align-right should probably use string-width
@ 2022-08-01 16:49 Adam Porter
2022-08-01 18:13 ` Juri Linkov
0 siblings, 1 reply; 4+ messages in thread
From: Adam Porter @ 2022-08-01 16:49 UTC (permalink / raw)
To: 56874
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#56874: 28.1.50; tab-bar-format-align-right should probably use string-width
2022-08-01 16:49 bug#56874: 28.1.50; tab-bar-format-align-right should probably use string-width Adam Porter
@ 2022-08-01 18:13 ` Juri Linkov
2022-08-05 20:32 ` Adam Porter
0 siblings, 1 reply; 4+ messages in thread
From: Juri Linkov @ 2022-08-01 18:13 UTC (permalink / raw)
To: Adam Porter; +Cc: 56874
> 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?
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#56874: 28.1.50; tab-bar-format-align-right should probably use string-width
2022-08-01 18:13 ` Juri Linkov
@ 2022-08-05 20:32 ` Adam Porter
2022-08-08 17:11 ` Juri Linkov
0 siblings, 1 reply; 4+ messages in thread
From: Adam Porter @ 2022-08-05 20:32 UTC (permalink / raw)
To: Juri Linkov; +Cc: 56874
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#56874: 28.1.50; tab-bar-format-align-right should probably use string-width
2022-08-05 20:32 ` Adam Porter
@ 2022-08-08 17:11 ` Juri Linkov
0 siblings, 0 replies; 4+ messages in thread
From: Juri Linkov @ 2022-08-08 17:11 UTC (permalink / raw)
To: Adam Porter; +Cc: 56874
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-08-08 17:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-01 16:49 bug#56874: 28.1.50; tab-bar-format-align-right should probably use string-width Adam Porter
2022-08-01 18:13 ` Juri Linkov
2022-08-05 20:32 ` Adam Porter
2022-08-08 17:11 ` Juri Linkov
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).