zsh-users
 help / color / mirror / code / Atom feed
* problem with bold prompt
@ 1997-01-30 23:13 Will Day
  1997-01-31  0:08 ` Zefram
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Will Day @ 1997-01-30 23:13 UTC (permalink / raw)
  To: zsh users mailing list

-----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@rom.oit.gatech.edu               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-----


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1997-01-31  4:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-01-30 23:13 problem with bold prompt Will Day
1997-01-31  0:08 ` Zefram
1997-01-31  0:14 ` Aaron Schrab
1997-01-31  4:23 ` Vidiot

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).