Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: problem in prompt in utf-8

On Sat, 17 Sep 2005 22:33:35 +0100, Peter Stephenson wrote about "Re: problem in prompt in utf-8":
> Peter Stephenson wrote:
> > This should fix the immediate problem, but note that the width of the
> > prompt isn't calculated correctly yet: we don't scan prompts for
> > multibyte characters.  Hence you might see oddities with the display
> > since the shell doesn't know the position of the cursor after the
> > prompt.  This is another thing on the list of fixes needed in zle.  (It
> > should come under the "not rocket science" heading, unlike the
> > completion code, so I hope it will be fixed relatively soon.)
> Yeah.
> I think this does the trick.  It relies on the fact that we usually print
> out the prompt completely, so we don't need to convert it to a wide
> character array, just count the characters in it.  We do this because
> prompts can have zero-width characters such as terminal escapes.  There
> was an optimisation that we could assume everything was hunky dory if
> the width was the same as the length of the prompt, but I don't think
> that works any more now I'm using wcwidth() for characters in the
> prompt.
> This may not be rocket science, but it's not trivial either, so there
> could well be glitches.
> The truncation code (stuff like "%12<...<") doesn't handle multibyte
> characters properly yet.  Also, I didn't put wcwidth() anywhere other
> than in the prompt width calculation, so characters in the editor
> buffers are still assumed to have screen width 1.

Thanks Peter, I installed your two patches, and they solve all the problems I
described in my email. They also solved a similar problem for other unicode
characters like single quote, U+2019, which I use for directory names, like
"Emperor’s New Clothes". Thanks again,


Dr. Zvi Har'El      mailto:rl@xxxxxxxxxxxxxxxxxxx    Department of Mathematics
tel:+972-54-4227607 icq:179294841    Technion - Israel Institute of Technology
fax:+972-4-8293388  http://www.math.technion.ac.il/~rl/    Haifa 32000, ISRAEL
"If you can't say somethin' nice, don't say nothin' at all." -- Thumper (1942)
                              Sunday, 14 Elul 5765, 18 September 2005, 12:47AM

Messages sorted by: Reverse Date, Date, Thread, Author