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

Re: code completition / cannot delete characters



Michael Worobcuk wrote:

Am 10.03.2007 um 22:55 schrieb Micah Cowan:

Frank Terbeck wrote:
Micah Cowan <micah@xxxxxxxxxx>:
Hm, how about this:

$ echo $PS1 > ps1
How about: echo ${(V)PS1}

What ever you want:

[hanno: /home/hanno]>echo ${(V)PS1}
[%{^[[1;33m%}%n: ^[[1;35m%}%d%{^[[0m%}]>
                  ^         ^
                           Where's the opening bracket for this one?
(view in a monospace font)

I note that that unprotected sequence is 7 chars long, as is "cd /usr". :)

The problem is that when zsh does the completion list, when it returns you back to your prompt, it does this by a combination of "move up" and/or "move back" sequences. So it has to keep an accurate count of where it was last. Unprotected escape sequences trick it into thinking there were more (visible) characters in the prompt than there actually were, and so it undercalculates the number of "move backs" it has to do.

After it gets to where it thinks the prompt was, it erases the rest of the line and re-types it ("cd /usr/src"), which is why you had two copies, one of which zsh wouldn't let you erase (because zsh thought you were already at the beginning of the prompt).

Let us know whether or not that fixes it for you!

-Micah



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