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

Re: PROMPT escape sequences

On Oct 8, 12:27pm, Atom Smasher wrote:
} expand-or-complete () {
}      PREDISPLAY=${fg[cyan]}
}      zle .expand-or-complete
} }
} zle -N expand-or-complete
} but it doesn't output any escape characters... just the text string 
} "^[[36m" as if there's an implied ${(V)fg[cyan]}.

Yes, that's the way PREDISPLAY works.

} what do i need to do to make that output a literal escape sequence?

Nothing.  You can't.

} why doesn't it work that way by default?

Because it would be whole lot more difficult for ZLE to keep track of
what the screen is supposed to look like if it had to track invisible
zero-width output.
} i also tried including "reset-prompt" within the redefined 
} "expand-or-complete", but didn't have any luck with that.

ZLE is still working very hard to re-print only exactly those parts
of the screen that have changed ... so it prints the left prompt,
and then emits a move-the-cursor sequence to jump to the end of the
line (or to the right prompt if you have one).  It only reprints the
characters that aren't part of the prompt if there are fewer of them
than the number of characters in the move-cursor sequence.

All of this optimized redraw stuff is to make the display fast enough
for a very slow TTY line, like a late-1980s dialup.  Maybe an easy 
way to "fix" this would be a switch to turn off all such optimization
and simply redraw everything all the time.

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