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

promptcr workaround



I've always been unsatisfied with the answer to FAQ entry
3.23 "How do I prevent the prompt overwriting output when there is
no newline?"  I dislike zsh's promptcr behavior both on and off.
I don't like silently losing the last line nor having a messed-up
prompt, and didn't like adding an extra newline on every command.

Here's a way to simulate adding the \n only when necessary:

    function precmd {
        echo -n ${(l:$COLUMNS:::)}
    }

This prints $COLUMNS spaces.  Iff there's any output on the line
already, it'll wrap to somewhere on the next line.  So when zsh
prints the \r it'll always erase only spaces.


-- 
Karl 2005-03-01 00:10



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