zsh-users
 help / color / mirror / code / Atom feed
* Autocorrection destroys my prompt.
@ 2006-05-21 10:33 Alexander Surma
  2006-05-23  7:42 ` Geoff Wing
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Surma @ 2006-05-21 10:33 UTC (permalink / raw)
  To: zsh-users

Hi,
I did a eye-candy (also eye-cancer) prompt.
Works fine.
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:
%{\e[1;32m%4(C<.../%3c<%d)%{\e[1;36m%}]%{\e(0qqqqqq\e(B%}[%{\e[1;33m%}%D{%d.
%m.%Y %H:%M}%{\e[1;36m%}]%{\e(0qqqqqq\e(B%}
[%{\e[1;31m%}%?%{\e[1;36m%}]\n%{\e(0mq\e(B%}
[%{\e[1;33m%}%h%{\e[1;36m%}]%{\e(0q\e(B%}%(#.%{\e[0;31m%}.
%{\e[1;36m%})>%{\e[m%} '

the last "->" is overwritten (at least on my pc).

MfG Alexander Surma


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

* Re: Autocorrection destroys my prompt.
  2006-05-21 10:33 Autocorrection destroys my prompt Alexander Surma
@ 2006-05-23  7:42 ` Geoff Wing
  0 siblings, 0 replies; 2+ messages in thread
From: Geoff Wing @ 2006-05-23  7:42 UTC (permalink / raw)
  To: Zsh Users

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


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

end of thread, other threads:[~2006-05-23  7:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-21 10:33 Autocorrection destroys my prompt Alexander Surma
2006-05-23  7:42 ` Geoff Wing

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