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

Re: get the number of active jobs to show in the prompt?



On Oct 3, 10:08pm, Vincent Lefevre wrote:
> > It's not the widget that's doing it.  It's the ZLE internal screen refresh
> 
> OK, so there could be another flag to tell whether to print "\n" or "\r".

Once again, it's not that simple.  It's not just printing a "\n" -- it's
moving the cursor to below the current editing area, which could be many
lines high.

And printing an '\r' instead might still put the new prompt in the middle
of said multi-line area.

At this point Geoff Wing is the right person to continue this discussion
if it's going to be continued, as he's the most recent primary author of
the ZLE screen refresh routines.

Meanwhile, since you know your own prompt doesn't change size, you could
try fooling with something like this:

    zmodload -i zsh/termcap
    function redraw-prompt {
	zle .clear-screen
	if (( BUFFERLINES < LINES - 1 ))
	then
	    precmd
	    echotc sc
	    echotc ho
	    print -nP "$PS1"
	    echotc rc
	fi
	return 0
    }
    zle -N clear-screen redraw-prompt

That'll only work for terminals that have sc/rc (save/restore cursor), and
your PS1 better not have %E in it.



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