Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
problem with bold prompt
- X-seq: zsh-users 638
- From: Will Day <willday@xxxxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxxxxxxx (zsh users mailing list)
- Subject: problem with bold prompt
- Date: Thu, 30 Jan 1997 18:13:25 -0500 (EST)
- Reply-to: willday@xxxxxxxxxxxxxxxxxx (Will Day)
-----BEGIN PGP SIGNED MESSAGE-----
This is a problem I've been fighting with for a long time, and which I only
recently began to grasp, when it got worse after I upgraded from 2.5.03 to
3.0.2. :)
My prompt is defined as:
export PS1="^[[1m${HOSTNAME}:^[[m%d) "
so that it appears as:
rom:/home/willday)
where the "rom" is bold.
It looks like zsh is counting the formatting characters as printable
characters on the command-line. Under 2.5.03, this would screw up
command-recall, and ctrl-U line clearing.
For instance, at the prompt (where # indicates the location of the cursor):
rom:/home/willday/src/done/zsh-2.5.03) #
hitting "ESC /" would move the cursor over seven characters:
rom:/home/willday/src/done/zsh-2.5.03) #
/
which corresponds to the seven non-printable characters in my prompt
(^[,[,1,m,^[,[,m).
Lines recalled with "/" would be printed at the 7-char offset:
rom:/home/willday/src/done/zsh-2.5.03) ls -dlF INSTALL README doc etc
examples help src
Lines recalled with just "ESC -" would not be offset, but command-line editing
would be screwed up. For instance, "ESC - b b b b" should bring up the line,
and go back 4 words, placing the cursor at "etc". Instead, it ends up 7
chars off, in the middle of "example":
rom:/home/willday/src/done/zsh-2.5.03) ls -dlF INSTALL README doc etc exa#ple
s help src
Under 3.0.2, it now also clears the line and starts overwriting when I reach
the right margin. For instance, a line that should look like this:
rom:/home/willday/src/done/zsh-3.0.2) ls -dlF INSTALL README Doc Etc Misc Src
Util
ends up looking like this:
isc Src Util
which makes it most unusable.
It doesn't seem to matter what terminal type I'm using (xterm, mac vt100,
linux console), nor which formatting codes I use (^[[34m for blue, etc),
but the offset does always correspond to the number of non-printable
characters in the prompt.
I managed to hack 3.0.2's zle_refresh.c to behave like 2.0.5 did in this
regard (that is, not to clear the line), so at least it's now usable again.
:) But I don't know enough about the code to go in and fix the problem.
______________________________________________________________________________
Will Day <PGP mail preferred> OIT, Georgia Tech, Atlanta 30332-0715
willday@xxxxxxxxxxxxxxxxxx http://rom.oit.gatech.edu/~willday/
=-> Opinions expressed are mine alone and do not reflect OIT policy <-=
Those who would give up essential Liberty, to purchase a little temporary
Safety, deserve neither Liberty nor Safety.
Benjamin Franklin, Pennsylvania Assembly, Nov. 11, 1755
-----BEGIN PGP SIGNATURE-----
Version: 2.6.3a
Charset: noconv
Comment: http://rom.oit.gatech.edu/~willday/pubkey.asc
iQCVAwUBMvEq+BDHlOdPw2ZdAQFTKgP/eQUjR/8aqE9jXpZrIAeAaZIqy23IFlOO
iflYxFPgIyLxTLiccxDeI2cYvzOwElMLXyfzhe11rydSpTUvhAtxyrf2b0YKy2Lu
YPFAqKAgZ5oH7oRCHNHqepDDfHWKMakWIHSoLxfpJgm2j2JstGsdIPEEBEahFhly
T9T+r0CCMjc=
=O+wh
-----END PGP SIGNATURE-----
Messages sorted by:
Reverse Date,
Date,
Thread,
Author