zsh-users
 help / color / mirror / code / Atom feed
From: Will Day <willday@rom.oit.gatech.edu>
To: zsh-users@math.gatech.edu (zsh users mailing list)
Subject: problem with bold prompt
Date: Thu, 30 Jan 1997 18:13:25 -0500 (EST)	[thread overview]
Message-ID: <199701302313.SAA12620@rom.oit.gatech.edu> (raw)

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


             reply	other threads:[~1997-01-30 23:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-01-30 23:13 Will Day [this message]
1997-01-31  0:08 ` Zefram
1997-01-31  0:14 ` Aaron Schrab
1997-01-31  4:23 ` Vidiot

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=199701302313.SAA12620@rom.oit.gatech.edu \
    --to=willday@rom.oit.gatech.edu \
    --cc=zsh-users@math.gatech.edu \
    /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).