[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: master 188bd80: gnus-shorten-url: Improve and avoid args-out-of-rang
From: |
Eli Zaretskii |
Subject: |
Re: master 188bd80: gnus-shorten-url: Improve and avoid args-out-of-range error |
Date: |
Tue, 14 Apr 2020 14:55:39 +0300 |
> From: Štěpán Němec <address@hidden>
> Date: Tue, 14 Apr 2020 11:26:22 +0200
> Cc: address@hidden
>
> Rewriting it to use `string-width' will require adjusting the callers,
> too, but that's probably a good thing, as it should lead to more
> correct results with strings containing wide characters. Still not
> necessarily really correct results, though, as AFAICT the "columns"
> which `string-width' speaks about are just an approximation, depending
> on the fonts used.
>
> E.g. with the default Chinese font emacs -Q uses on my system, I get
> roughly 8.5 "columns" per 5 Chinese characters, not 10 as claimed by
> `string-width'.
AFAIK, string-width is exact only on TTY frames.
> I also don't understand why the result of `string-width' should depend
> on `current-language-environment', e.g. with "Chinese-GBK",
> (string-width "…") returns 2 (why?!), with "English" or "UTF-8" it
> returns 1, even though the display (font, "columns") stays the same for
> all of them.
See the definition of the Chinese-GBK language, it calls
use-cjk-char-width-table that sets up the char-width-table entries
specially, not sure why. Maybe Handa-san can comment on this.
> (BTW, I have little experience with RTL scripts, but, doesn't in
> that case the ellipsis end up on the logically wrong side, i.e. with
> the beginning/end of string reversed?):
No. The ellipsis should be _before_ the tail, in the reading order,
and that is what you get here. If you want to dwell on this issue a
bit longer, look what the truncated string looks like in a buffer
whose bidi-paragraph-direction is set to right-to-left.
- Re: master 188bd80: gnus-shorten-url: Improve and avoid args-out-of-range error, Stefan Monnier, 2020/04/13
- Re: master 188bd80: gnus-shorten-url: Improve and avoid args-out-of-range error, Štěpán Němec, 2020/04/14
- Re: master 188bd80: gnus-shorten-url: Improve and avoid args-out-of-range error,
Eli Zaretskii <=
- Re: master 188bd80: gnus-shorten-url: Improve and avoid args-out-of-range error, Štěpán Němec, 2020/04/14
- Re: master 188bd80: gnus-shorten-url: Improve and avoid args-out-of-range error, Eli Zaretskii, 2020/04/14
- Re: master 188bd80: gnus-shorten-url: Improve and avoid args-out-of-range error, Stefan Monnier, 2020/04/14
- Re: master 188bd80: gnus-shorten-url: Improve and avoid args-out-of-range error, Štěpán Němec, 2020/04/14
- Re: master 188bd80: gnus-shorten-url: Improve and avoid args-out-of-range error, Eli Zaretskii, 2020/04/14