zsh-workers
 help / color / mirror / code / Atom feed
From: "Zvi Har'El" <rl@math.technion.ac.il>
To: Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
Cc: Zsh hackers list <zsh-workers@sunsite.dk>
Subject: Re: problem in prompt in utf-8
Date: Sun, 18 Sep 2005 00:51:11 +0300	[thread overview]
Message-ID: <20050917215111.GA5756@fermat.math.technion.ac.il> (raw)
In-Reply-To: <20050917213337.4A2DB8638@pwstephenson.fsnet.co.uk>

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,

Zvi.

-- 
Dr. Zvi Har'El      mailto:rl@math.technion.ac.il    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


      reply	other threads:[~2005-09-17 21:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-11 12:13 Zvi Har'El
2005-09-11 16:55 ` Zvi Har'El
2005-09-11 17:05   ` Zvi Har'El
2005-09-17 18:15 ` Peter Stephenson
2005-09-17 21:33   ` Peter Stephenson
2005-09-17 21:51     ` Zvi Har'El [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050917215111.GA5756@fermat.math.technion.ac.il \
    --to=rl@math.technion.ac.il \
    --cc=pws@pwstephenson.fsnet.co.uk \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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 NNTP newsgroup(s).