emacs-devel
[Top][All Lists]
Advanced

[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 15:42:55 +0300

> From: Štěpán Němec <address@hidden>
> Cc: Kenichi Handa <address@hidden>,  address@hidden,
>   address@hidden
> Date: Tue, 14 Apr 2020 14:24:28 +0200
> 
> On Tue, 14 Apr 2020 14:55:39 +0300
> Eli Zaretskii wrote:
> 
> >> 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.
> 
> Interesting, thanks. Given that I remember the issue (for graphical
> frames) being discussed multiple times in the past, asking whether
> making it work by default on those as well would be too hard, is
> probably pointless?

I don't remember past discussions, but I guess the main difficulty
with making char-width mode accurate on GUI frames is that doing so
requires access to the font information, something that can be slow.
maybe we should have two separate APIs, the other one more accurate
but also potentially slower.

> > 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.
> 
> Now I see that "…" causes other stange behaviour with Chinese-GBK on TTY
> frames, too, probably as an artifact of its having "width" 2: it causes
> cursor to skip the following character when moving over it.

I think the GBK setting assumes some specific fonts to be used.  Does
anything change if you start Emacs in a GBK locale to begin with?

> > 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.
> 
> Thanks. I was mainly concerned about the function name: if that's the
> case, it had better be called something like "truncate-string-beginning"
> instead of "-left"?

Yes, "-beginning" would be more accurate, I think.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]