Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Autocorrection destroys my prompt.



On Sunday 2006-05-21 20:32 +1000, Alexander Surma output:
: I did a eye-candy (also eye-cancer) prompt.
: Works fine.

Not for me.

: But when I use the autocorrection, my command I already typed overwrites some 
: characters of the prompt?
: Why and what to do?
: The prompt is:
: PS1=$'%{\e[1;36m\e(0lq\e(B%}[%(!.%{\e[0;31m%}.%{\e[1;32m%})%n%{\e[1;33m%}@%m:
                      ^^
Surround non printing characters with %{ and %} .  On the first line
the "lq" which form graphic characters are printed characters and should
not be enclosed.  So, the first line would start off with
  PS1=$'%{\e[1;36m\e(0%}lq%{\e(B%}

Fix up the rest of the prompt the same way.  A quick check to see if
it's obviously(*) wrong is to set an RPROMPT,  e.g. RPROMPT="a" should
put the letter ``a'' in the second last column of the screen (on the
cursor row).  Obviously, unset RPROMPT if you don't want it in normal
use.

(*) if you mark the wrong characters as printing/non-printing characters
it may seem to align correctly . . . initially, but do wrong things later.

Regards,
Geoff



Messages sorted by: Reverse Date, Date, Thread, Author