zsh-workers
 help / color / mirror / code / Atom feed
From: "Zvi Har'El" <rl@math.technion.ac.il>
To: Zsh hackers list <zsh-workers@sunsite.dk>
Subject: Re: problem in prompt in utf-8
Date: Sun, 11 Sep 2005 19:55:16 +0300	[thread overview]
Message-ID: <20050911165516.GA23234@fermat.math.technion.ac.il> (raw)
In-Reply-To: <20050911121345.GA14384@fermat.math.technion.ac.il>

I found out that the problem of the prompt (rather then the print -P $PS1), is
TERM dependent. When I set TERM=dumb, the prompt is printed correctly on the
screen, but afterwords the cursor moves to the right several positions which
is seems to be identical in length to the size of the prompt. Since each
character is 2 bytes, I suppose the length is incorrectly calculated.

On Sun, 11 Sep 2005 15:13:45 +0300, Zvi Har'El wrote about "problem in prompt in utf-8":
> Hello,
> 
> I have started using zsh-4.3.0 from the CVS, in a uft-8 locale. I enjoy it
> very much. However, I have a problem with the prompting. This is not new, but
> since the completion now works nicely, I thought I'll mention it, since it is
> not solved yet.
> 
> I have the setting
> 
>     PS1=%/$\ 
> 
> I expect that 
> 
>     print -P $PS1 
> 
> 
> and
> 
>     pwd 
> 
> will give the same output, which will also be the zsh prompt (except the final
> $ and space, of course). However, if the current directory name contains
> hebrew letter, which are in the range U+05D0 to U+05EA, i.e., the utf-8
> sequences have two bytes, with the first one is always 0xD7 (M-W) and the
> second  in the range 0x90 (M-^P) to 0xAA (M-*). I mkdir'ed a directory which
> has all the letters in this range:
> 
> /home/rl$ mkdir אבגדהוזחטיךכלםמןנסעףפץצקרשת
> 
> cd'ed to that directory:
> 
> /home/rl$ cd אבגדהוזחטיךכלםמןנסעףפץצקרשת 
> 
> I got as an echo a correct result:
> 
> ~/אבגדהוזחטיךכלםמןנסעףפץצקרשת
> 
> The next prompt had invalid utf-8 sequences:
> 
> 
> /home/rl/������������לםמןנסעףפץצקרשת$ 
> 
> 
> To make it more specific, all the range U+05D0 to U+05DB,  (second byte 0x90
> to 0x9ba) got invalid. I don't know exactly what is wrong. Notice that 'pwd'
> produces
> 
> /home/rl/אבגדהוזחטיךכלםמןנסעףפץצקרשת
> 
> I.e, all the letters are correct, while 'print -P $PS1' produces
> 
> /home/rl/אבגדהוזחטיך�לםמןנסעףפץצקרשת$
> 
> With exactly one invalid utf-8 seqience, more specifically, U+05DB (second
> byte 0x9ba) - the last one in the previous range, is bad.
> 
> print -P $PS1 | cat -v produces
> 
> /home/rl/M-WM-^PM-WM-^QM-WM-^RM-WM-^SM-WM-^TM-WM-^UM-WM-^VM-WM-^WM-WM-^XM-WM-^YM-WM-^ZM-WM-WM-^\M-WM-^]M-WM-^^M-WM-^_M-WM- M-WM-!M-WM-"M-WM-#M-WM-$M-WM-%M-WM-&M-WM-'M-WM-(M-WM-)M-WM-*$
> 
> while pwd | cat -v produces
> 
> /home/rl/M-WM-^PM-WM-^QM-WM-^RM-WM-^SM-WM-^TM-WM-^UM-WM-^VM-WM-^WM-WM-^XM-WM-^YM-WM-^ZM-WM-^[M-WM-^\M-WM-^]M-WM-^^M-WM-^_M-WM- M-WM-!M-WM-"M-WM-#M-WM-$M-WM-%M-WM-&M-WM-'M-WM-(M-WM-)M-WM-*
> 
> It is perhaps hard to see the difference, but a close inspection shows that
> the first string contains a solitary M-W between the M-WM-^Z and the the
> M-WM-^\ sequences, while the second one contains there the sequence M-WM-^[ ,
> i.e., a M-^[, or Meta-Esacpe, was dropped from the string. 
> 
> Unfortunately, I didn't find an easy way to put the real prompt on a file, so
> I can't tell what is the exact sequences in it.
> 
> I hope this make some sense. 
> 
> -- 
> 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, 7 Elul 5765, 11 September 2005,  1:54PM

-- 
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, 8 Elul 5765, 11 September 2005,  7:51PM


  reply	other threads:[~2005-09-11 16:55 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 [this message]
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

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=20050911165516.GA23234@fermat.math.technion.ac.il \
    --to=rl@math.technion.ac.il \
    --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).