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 Wed, Oct 03, 2001 at 15:58:06 +0000, Bart Schaefer wrote:
> If notify isn't involved, precmd is already sufficient.

Well, I've always had notify and I do want it.

> If notify is involved, then the fact that the prompt could change
> length and that the current "prompt level" could need to change from
> PS2 or deeper back to PS1, leads to all the objections that have
> been raised.

In my case, the length isn't changed. So, this is not my problem.

> } How can I do that (to rebuild the prompt when clear-screen is called)?
> Basically the same way I did it in push-line-at-random:
>     function redraw-prompt {
> 	local nested=${(%):-%_}
> 	# zle .clear-screen	# You may or may not want this

I want this, so I uncommented it.

> 	if [[ -n $nested ]]
> 	then
> 	    zle .push-line-or-edit
> 	else
> 	    zle .push-input
> 	    zle .send-break	# Force new prompt; sorry about beeping
> 	fi
>     }
>     # Pick one:
>     # zle -N clear-screen redraw-prompt
>     # zle -N redraw-prompt; bindkey '^L' redraw-prompt

This doesn't work: the screen is cleared, but then, the prompt is
printed twice. Replacing "zle .clear-screen" by "clear" almost works.
The problem is that push-line seems to send a \n.

Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.org/> - 100%
validated HTML - Acorn Risc PC, Yellow Pig 17, Championnat International des
Jeux Mathématiques et Logiques, TETRHEX, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA

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