GNU bug report logs - #33232
`gnus-summary-line-format' padding doesn’t work in gui when there are multiple-column-width characters

Previous Next

Packages: gnus, emacs;

Reported by: "Garreau\, Alexandre" <galex-713 <at> galex-713.eu>

Date: Thu, 1 Nov 2018 21:59:02 UTC

Severity: minor

Tags: wontfix

Merged with 19872

Found in versions 24.4, 5.13, 5.130014

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

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 33232 in the body.
You can then email your comments to 33232 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, bugs <at> gnus.org:
bug#33232; Package emacs,gnus. (Thu, 01 Nov 2018 21:59:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Garreau\, Alexandre" <galex-713 <at> galex-713.eu>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org. (Thu, 01 Nov 2018 21:59:03 GMT) Full text and rfc822 format available.

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

From: "Garreau\, Alexandre" <galex-713 <at> galex-713.eu>
To: submit <at> debbugs.gnu.org (The Gnus Bugfixing Girls + Boys)
Subject: `gnus-summary-line-format' padding doesn’t work
 in gui when there are multiple-column-width characters
Date: Thu, 01 Nov 2018 22:58:32 +0100
Given this (rectangular) excerpt from my bug-gnu-emacs summary:
> …01-nov…[-> 33224 <at> debbugs.gnu.org        ] bug#33224: `message-simpli…
> …01-nov…[Noam Postavsky                  ] bug#33225: [debbugs.el] Do…
> …01-nov…[-> Noam Postavsky               ]  bug#33225: [debbugs.el] D…
> …01-nov…[積丹尼 Dan Jacobson             ] bug#33226: chromium, firef…

On my system (Debian, with Xorg, i3, GUI Emacs), the last line has its
“]” sooner than the others.  This is because `gnus-correct-length'
(along with `char-width') says each of the first three characters is
two-columns wide: but under GUI, this is untrue, as these three
collectively form exactely 5 columns (and not six, as would calculate
`gnus-correct-length').

You can check that by eval’ing:
> (window-text-pixel-size nil (- (point) 593) (- (point) 588))
> (window-text-pixel-size nil (- (point) 583) (- (point) 580))
which return the width of the three first characters after “[” in the
two last summary lines.

According `gnus-correct-length' they’r the same size:
> (gnus-correct-length "[積丹尼 Dan Jacobson             ]")
> (gnus-correct-length "[-> Noam Postavsky               ]")

According `char-width' the fact each character is considered to have a
width which is a multiple of the others makes them the same size:
> (mapcar #'char-width "[積丹尼 Dan Jacobson             ]")
> (mapcar #'char-width "[-> Noam Postavsky               ]")

So would it be better to get gnus-correct-length keep returning a column
number but as a float to be somewhat compatible? or working with pixels
when operating in a GUI frame? but how would padding, which is said to
be in numbers of column, operate then?

or should it stay with a behavior that works in terminal but breaks in
gui?

I’m reporting this at least for archive, in case someone have an idea.
But I’m not sure the solution is that trivial.

Gnus v5.13
GNU Emacs 25.1.1 (i686-pc-linux-gnu, GTK+ Version 3.22.11)
 of 2017-09-15, modified by Debian




Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#33232; Package emacs,gnus. (Thu, 01 Nov 2018 22:55:01 GMT) Full text and rfc822 format available.

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

From: Eric Abrahamsen <eric <at> ericabrahamsen.net>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#33232: `gnus-summary-line-format' padding doesn’t work in gui when there are multiple-column-width
 characters
Date: Thu, 01 Nov 2018 15:52:14 -0700
"Garreau, Alexandre" <galex-713 <at> galex-713.eu> writes:

> Given this (rectangular) excerpt from my bug-gnu-emacs summary:
>> …01-nov…[-> 33224 <at> debbugs.gnu.org        ] bug#33224: `message-simpli…
>> …01-nov…[Noam Postavsky                  ] bug#33225: [debbugs.el] Do…
>> …01-nov…[-> Noam Postavsky               ]  bug#33225: [debbugs.el] D…
>> …01-nov…[積丹尼 Dan Jacobson             ] bug#33226: chromium, firef…
>
> On my system (Debian, with Xorg, i3, GUI Emacs), the last line has its
> “]” sooner than the others.  This is because `gnus-correct-length'
> (along with `char-width') says each of the first three characters is
> two-columns wide: but under GUI, this is untrue, as these three
> collectively form exactely 5 columns (and not six, as would calculate
> `gnus-correct-length').

Someone just reported something similar on the org list, that
`string-width' doesn't return the actual width occupied by the string,
which you'd think would be the whole point.

(BTW, it looks like `gnus-correct-length' can be replaced by
`string-width'.)





Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#33232; Package emacs,gnus. (Thu, 01 Nov 2018 23:27:07 GMT) Full text and rfc822 format available.

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

From: Noam Postavsky <npostavs <at> gmail.com>
To: Eric Abrahamsen <eric <at> ericabrahamsen.net>
Cc: 33232 <at> debbugs.gnu.org
Subject: Re: bug#33232: `gnus-summary-line-format' padding doesn’t work in gui when there are multiple-column-width
 characters
Date: Thu, 01 Nov 2018 19:26:11 -0400
Eric Abrahamsen <eric <at> ericabrahamsen.net> writes:

> "Garreau, Alexandre" <galex-713 <at> galex-713.eu> writes:
>
>> Given this (rectangular) excerpt from my bug-gnu-emacs summary:
>>> …01-nov…[-> 33224 <at> debbugs.gnu.org        ] bug#33224: `message-simpli…
>>> …01-nov…[Noam Postavsky                  ] bug#33225: [debbugs.el] Do…
>>> …01-nov…[-> Noam Postavsky               ]  bug#33225: [debbugs.el] D…
>>> …01-nov…[積丹尼 Dan Jacobson             ] bug#33226: chromium, firef…
>>
>> On my system (Debian, with Xorg, i3, GUI Emacs), the last line has its
>> “]” sooner than the others.  This is because `gnus-correct-length'
>> (along with `char-width') says each of the first three characters is
>> two-columns wide: but under GUI, this is untrue, as these three
>> collectively form exactely 5 columns (and not six, as would calculate
>> `gnus-correct-length').
>
> Someone just reported something similar on the org list, that
> `string-width' doesn't return the actual width occupied by the string,
> which you'd think would be the whole point.

See Bug#31588, the width of these characters depends on the font, so
string-width (which works only on a string) can't give the right answer.
Or, from another point of view, it's the font's fault for being too
narrow on these characters.

> (BTW, it looks like `gnus-correct-length' can be replaced by
> `string-width'.)

Yep.





Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#33232; Package emacs,gnus. (Thu, 01 Nov 2018 23:53:01 GMT) Full text and rfc822 format available.

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

From: Eric Abrahamsen <eric <at> ericabrahamsen.net>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: 33232 <at> debbugs.gnu.org
Subject: Re: bug#33232: `gnus-summary-line-format' padding doesn’t work in gui when there are multiple-column-width
 characters
Date: Thu, 01 Nov 2018 16:52:32 -0700
On 11/01/18 19:26 PM, Noam Postavsky wrote:
> Eric Abrahamsen <eric <at> ericabrahamsen.net> writes:
>
>> "Garreau, Alexandre" <galex-713 <at> galex-713.eu> writes:
>>
>>> Given this (rectangular) excerpt from my bug-gnu-emacs summary:
>>>> …01-nov…[-> 33224 <at> debbugs.gnu.org        ] bug#33224: `message-simpli…
>>>> …01-nov…[Noam Postavsky                  ] bug#33225: [debbugs.el] Do…
>>>> …01-nov…[-> Noam Postavsky               ]  bug#33225: [debbugs.el] D…
>>>> …01-nov…[積丹尼 Dan Jacobson             ] bug#33226: chromium, firef…
>>>
>>> On my system (Debian, with Xorg, i3, GUI Emacs), the last line has its
>>> “]” sooner than the others.  This is because `gnus-correct-length'
>>> (along with `char-width') says each of the first three characters is
>>> two-columns wide: but under GUI, this is untrue, as these three
>>> collectively form exactely 5 columns (and not six, as would calculate
>>> `gnus-correct-length').
>>
>> Someone just reported something similar on the org list, that
>> `string-width' doesn't return the actual width occupied by the string,
>> which you'd think would be the whole point.
>
> See Bug#31588, the width of these characters depends on the font, so
> string-width (which works only on a string) can't give the right answer.
> Or, from another point of view, it's the font's fault for being too
> narrow on these characters.

Yeah, I figured it was probably a font issue, but still it's kind of
misleading to have a function that *sounds* like it's going to handle
the font issue, but doesn't.

>> (BTW, it looks like `gnus-correct-length' can be replaced by
>> `string-width'.)
>
> Yep.

Made a bug report.




Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#33232; Package emacs,gnus. (Fri, 02 Nov 2018 06:38:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Eric Abrahamsen <eric <at> ericabrahamsen.net>
Cc: 33232 <at> debbugs.gnu.org, npostavs <at> gmail.com
Subject: Re: bug#33232: `gnus-summary-line-format' padding
 doesn’t work in gui when there are
 multiple-column-width characters
Date: Fri, 02 Nov 2018 08:36:43 +0200
> From: Eric Abrahamsen <eric <at> ericabrahamsen.net>
> Date: Thu, 01 Nov 2018 16:52:32 -0700
> Cc: 33232 <at> debbugs.gnu.org
> 
> >>> Given this (rectangular) excerpt from my bug-gnu-emacs summary:
> >>>> …01-nov…[-> 33224 <at> debbugs.gnu.org        ] bug#33224: `message-simpli…
> >>>> …01-nov…[Noam Postavsky                  ] bug#33225: [debbugs.el] Do…
> >>>> …01-nov…[-> Noam Postavsky               ]  bug#33225: [debbugs.el] D…
> >>>> …01-nov…[積丹尼 Dan Jacobson             ] bug#33226: chromium, firef…
> >>>
> >>> On my system (Debian, with Xorg, i3, GUI Emacs), the last line has its
> >>> “]” sooner than the others.  This is because `gnus-correct-length'
> >>> (along with `char-width') says each of the first three characters is
> >>> two-columns wide: but under GUI, this is untrue, as these three
> >>> collectively form exactely 5 columns (and not six, as would calculate
> >>> `gnus-correct-length').
> >>
> >> Someone just reported something similar on the org list, that
> >> `string-width' doesn't return the actual width occupied by the string,
> >> which you'd think would be the whole point.
> >
> > See Bug#31588, the width of these characters depends on the font, so
> > string-width (which works only on a string) can't give the right answer.
> > Or, from another point of view, it's the font's fault for being too
> > narrow on these characters.
> 
> Yeah, I figured it was probably a font issue, but still it's kind of
> misleading to have a function that *sounds* like it's going to handle
> the font issue, but doesn't.

The only reliable way of getting pixelwise alignment in GUI frames is
to use the :align-to display spec, or other related display property
specs that provide pixelwise width and alignment.




Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#33232; Package emacs,gnus. (Fri, 02 Nov 2018 06:43:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Eric Abrahamsen <eric <at> ericabrahamsen.net>
Cc: 33232 <at> debbugs.gnu.org
Subject: Re: bug#33232: `gnus-summary-line-format' padding
 doesn’t work in gui when there are
 multiple-column-width characters
Date: Fri, 02 Nov 2018 08:42:06 +0200
> From: Eric Abrahamsen <eric <at> ericabrahamsen.net>
> Date: Thu, 01 Nov 2018 15:52:14 -0700
> 
> Someone just reported something similar on the org list, that
> `string-width' doesn't return the actual width occupied by the string,
> which you'd think would be the whole point.

string-width does the best job it can, but you cannot hope to get
exact results when using variable-width fonts.  What string-width
returns should be correct on TTY frames, and only an approximation of
GUI frames, when you mix scripts and thus fonts in the same string.

For pixel-level accuracy on display, you must use display 'space' and
'align' properties.




Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#33232; Package emacs,gnus. (Fri, 02 Nov 2018 06:44:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Eric Abrahamsen <eric <at> ericabrahamsen.net>
Cc: 33232 <at> debbugs.gnu.org, npostavs <at> gmail.com
Subject: Re: bug#33232: `gnus-summary-line-format' padding
 doesn’t work in gui when there are
 multiple-column-width characters
Date: Fri, 02 Nov 2018 08:43:26 +0200
> From: Eric Abrahamsen <eric <at> ericabrahamsen.net>
> Date: Thu, 01 Nov 2018 16:52:32 -0700
> Cc: 33232 <at> debbugs.gnu.org
> 
> > See Bug#31588, the width of these characters depends on the font, so
> > string-width (which works only on a string) can't give the right answer.
> > Or, from another point of view, it's the font's fault for being too
> > narrow on these characters.
> 
> Yeah, I figured it was probably a font issue, but still it's kind of
> misleading to have a function that *sounds* like it's going to handle
> the font issue, but doesn't.

What part of "string-width" tells you that it handles fonts?




Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#33232; Package emacs,gnus. (Fri, 02 Nov 2018 19:17:01 GMT) Full text and rfc822 format available.

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

From: Eric Abrahamsen <eric <at> ericabrahamsen.net>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#33232: `gnus-summary-line-format' padding doesn’t work in gui when there are multiple-column-width
 characters
Date: Fri, 02 Nov 2018 12:15:50 -0700
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Eric Abrahamsen <eric <at> ericabrahamsen.net>
>> Date: Thu, 01 Nov 2018 16:52:32 -0700
>> Cc: 33232 <at> debbugs.gnu.org
>> 
>> >>> Given this (rectangular) excerpt from my bug-gnu-emacs summary:
>> >>>> …01-nov…[-> 33224 <at> debbugs.gnu.org        ] bug#33224: `message-simpli…
>> >>>> …01-nov…[Noam Postavsky                  ] bug#33225: [debbugs.el] Do…
>> >>>> …01-nov…[-> Noam Postavsky               ]  bug#33225: [debbugs.el] D…
>> >>>> …01-nov…[積丹尼 Dan Jacobson             ] bug#33226: chromium, firef…
>> >>>
>> >>> On my system (Debian, with Xorg, i3, GUI Emacs), the last line has its
>> >>> “]” sooner than the others.  This is because `gnus-correct-length'
>> >>> (along with `char-width') says each of the first three characters is
>> >>> two-columns wide: but under GUI, this is untrue, as these three
>> >>> collectively form exactely 5 columns (and not six, as would calculate
>> >>> `gnus-correct-length').
>> >>
>> >> Someone just reported something similar on the org list, that
>> >> `string-width' doesn't return the actual width occupied by the string,
>> >> which you'd think would be the whole point.
>> >
>> > See Bug#31588, the width of these characters depends on the font, so
>> > string-width (which works only on a string) can't give the right answer.
>> > Or, from another point of view, it's the font's fault for being too
>> > narrow on these characters.
>> 
>> Yeah, I figured it was probably a font issue, but still it's kind of
>> misleading to have a function that *sounds* like it's going to handle
>> the font issue, but doesn't.
>
> The only reliable way of getting pixelwise alignment in GUI frames is
> to use the :align-to display spec, or other related display property
> specs that provide pixelwise width and alignment.

Interesting, maybe that's something that Org tables should be using.

Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Eric Abrahamsen <eric <at> ericabrahamsen.net>
>> Date: Thu, 01 Nov 2018 16:52:32 -0700
>> Cc: 33232 <at> debbugs.gnu.org
>> 
>> > See Bug#31588, the width of these characters depends on the font, so
>> > string-width (which works only on a string) can't give the right answer.
>> > Or, from another point of view, it's the font's fault for being too
>> > narrow on these characters.
>> 
>> Yeah, I figured it was probably a font issue, but still it's kind of
>> misleading to have a function that *sounds* like it's going to handle
>> the font issue, but doesn't.
>
> What part of "string-width" tells you that it handles fonts?

No, I know that wasn't a reasonable expectation, but I think it's an
easy mistake to make.





Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#33232; Package emacs,gnus. (Sat, 22 Jun 2019 13:20:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: "Garreau\, Alexandre" <galex-713 <at> galex-713.eu>
Cc: 33232 <at> debbugs.gnu.org
Subject: Re: bug#33232: `gnus-summary-line-format' padding doesn’t work in gui when there are multiple-column-width
 characters
Date: Sat, 22 Jun 2019 15:19:16 +0200
"Garreau, Alexandre" <galex-713 <at> galex-713.eu> writes:

> Given this (rectangular) excerpt from my bug-gnu-emacs summary:
>> …01-nov…[-> 33224 <at> debbugs.gnu.org        ] bug#33224: `message-simpli…
>> …01-nov…[Noam Postavsky                  ] bug#33225: [debbugs.el] Do…
>> …01-nov…[-> Noam Postavsky               ]  bug#33225: [debbugs.el] D…
>> …01-nov…[積丹尼 Dan Jacobson             ] bug#33226: chromium, firef…
>
> On my system (Debian, with Xorg, i3, GUI Emacs), the last line has its
> “]” sooner than the others.  This is because `gnus-correct-length'
> (along with `char-width') says each of the first three characters is
> two-columns wide: but under GUI, this is untrue, as these three
> collectively form exactely 5 columns (and not six, as would calculate
> `gnus-correct-length').

Yes, using characters from a mixture of fonts that have widths that do
not add up to multiples of each other just isn't supported by Gnus.  To
do so would require a rewrite of the machinery that generates the
buffers, and gnus-summary-line-format would have to be obsoleted and
something new that uses display properties with align-to could be used.

So I'm closing this bug report as a "wontfix".

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) wontfix. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 22 Jun 2019 13:20:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 33232 <at> debbugs.gnu.org and "Garreau\, Alexandre" <galex-713 <at> galex-713.eu> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 22 Jun 2019 13:20:02 GMT) Full text and rfc822 format available.

Did not alter fixed versions and reopened. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 23 Jun 2019 13:00:02 GMT) Full text and rfc822 format available.

Forcibly Merged 21071 28331 33232. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 23 Jun 2019 13:02:01 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 21071 <at> debbugs.gnu.org and Nikolaus Rath <Nikolaus <at> rath.org> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 23 Jun 2019 13:03:02 GMT) Full text and rfc822 format available.

Did not alter fixed versions and reopened. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 23 Jun 2019 13:03:02 GMT) Full text and rfc822 format available.

Disconnected #33232 from all other report(s). Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 23 Jun 2019 13:04:02 GMT) Full text and rfc822 format available.

Merged 19872 33232. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 23 Jun 2019 13:05:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 19872 <at> debbugs.gnu.org and Sebastien Vauban <sva-news <at> mygooglest.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 23 Jun 2019 13:07: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. (Mon, 22 Jul 2019 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 278 days ago.

Previous Next


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