* precmd not being updated when I want
@ 2003-09-08 20:18 Jesper Holmberg
2003-09-08 20:24 ` Wayne Davison
0 siblings, 1 reply; 7+ messages in thread
From: Jesper Holmberg @ 2003-09-08 20:18 UTC (permalink / raw)
To: Zsh-users List
I have this:
precmd() { psvar[1]=$#jobtexts; [[ $#jobtexts -eq 0 ]] && psvar[1]=0; }
PS1="%(1v.%v .)$cpath${end}%# "
which gives me the number of jobs first in my prompt. It works very well.
However, if a job finishes, the number of jobs in the prompt does not
update until I type a new command and hit <enter>. Thus:
0 jesper@strindberg:~% sleep 1 &
[1] 7392
1 jesper@strindberg:~%
[1] + done sleep 1
1 jesper@strindberg:~%
0 jesper@strindberg:~%
Notice how sleep reports it is finished, but the prompt still shows "1".
Only when I hit <enter> on the second to last line, the "1" is turned into
a "0". Is there a way to fix this?
TIA,
Jesper
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: precmd not being updated when I want
2003-09-08 20:18 precmd not being updated when I want Jesper Holmberg
@ 2003-09-08 20:24 ` Wayne Davison
2003-09-08 20:31 ` Jesper Holmberg
0 siblings, 1 reply; 7+ messages in thread
From: Wayne Davison @ 2003-09-08 20:24 UTC (permalink / raw)
To: Zsh-users List
On Mon, Sep 08, 2003 at 10:18:11PM +0200, Jesper Holmberg wrote:
> Notice how sleep reports it is finished, but the prompt still shows "1".
I note that using %j in the PROMPT does exactly the same thing. FYI.
..wayne..
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: precmd not being updated when I want
2003-09-08 20:24 ` Wayne Davison
@ 2003-09-08 20:31 ` Jesper Holmberg
2003-09-08 20:58 ` Wayne Davison
0 siblings, 1 reply; 7+ messages in thread
From: Jesper Holmberg @ 2003-09-08 20:31 UTC (permalink / raw)
To: Zsh-users List
* On Mon Sep 08, Wayne Davison wrote:
> On Mon, Sep 08, 2003 at 10:18:11PM +0200, Jesper Holmberg wrote:
> > Notice how sleep reports it is finished, but the prompt still shows "1".
>
> I note that using %j in the PROMPT does exactly the same thing. FYI.
Thanks for your suggestion, but that doesn't seem to work for me. And I
can't find %j in the manual either. I'm using zsh 4.0.7, BTW.
Jesper
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: precmd not being updated when I want
2003-09-08 20:31 ` Jesper Holmberg
@ 2003-09-08 20:58 ` Wayne Davison
2003-09-09 1:10 ` Bart Schaefer
0 siblings, 1 reply; 7+ messages in thread
From: Wayne Davison @ 2003-09-08 20:58 UTC (permalink / raw)
To: Zsh-users List
On Mon, Sep 08, 2003 at 10:31:30PM +0200, Jesper Holmberg wrote:
> Thanks for your suggestion, but that doesn't seem to work for me.
That wasn't a suggestion, that was my noting that %j was broken in
exactly the same way. (I'm using 4.1.1, FYI.) I assume that the
reason for the failure is that the re-prompting is just a redraw, so
zsh does no re-evaluation of the prompt at that point. I haven't had
a chance to look at it, though.
..wayne..
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: precmd not being updated when I want
2003-09-08 20:58 ` Wayne Davison
@ 2003-09-09 1:10 ` Bart Schaefer
2003-09-09 7:05 ` Jesper Holmberg
0 siblings, 1 reply; 7+ messages in thread
From: Bart Schaefer @ 2003-09-09 1:10 UTC (permalink / raw)
To: Zsh-users List
On Sep 8, 1:58pm, Wayne Davison wrote:
}
} I assume that the reason for the failure is that the re-prompting is
} just a redraw, so zsh does no re-evaluation of the prompt at that
} point.
Exactly so.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: precmd not being updated when I want
2003-09-09 1:10 ` Bart Schaefer
@ 2003-09-09 7:05 ` Jesper Holmberg
2003-09-09 16:22 ` Bart Schaefer
0 siblings, 1 reply; 7+ messages in thread
From: Jesper Holmberg @ 2003-09-09 7:05 UTC (permalink / raw)
To: Zsh-users List
* On Tue Sep 09, Bart Schaefer wrote:
> On Sep 8, 1:58pm, Wayne Davison wrote:
> }
> } I assume that the reason for the failure is that the re-prompting is
> } just a redraw, so zsh does no re-evaluation of the prompt at that
> } point.
>
> Exactly so.
Right, I kind of suspected that. And is there any way of forcing a
re-evaluation?
Jesper
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: precmd not being updated when I want
2003-09-09 7:05 ` Jesper Holmberg
@ 2003-09-09 16:22 ` Bart Schaefer
0 siblings, 0 replies; 7+ messages in thread
From: Bart Schaefer @ 2003-09-09 16:22 UTC (permalink / raw)
To: Zsh-users List
On Sep 9, 9:05am, Jesper Holmberg wrote:
} Subject: Re: precmd not being updated when I want
}
} > On Sep 8, 1:58pm, Wayne Davison wrote:
} > }
} > } just a redraw, so zsh does no re-evaluation of the prompt
}
} And is there any way of forcing a re-evaluation?
No, I don't believe that there is. A re-evaluation happens only after
accept-line or send-break, and there's no way to have either of those
invoked without user interaction of some kind.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2003-09-09 16:23 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-08 20:18 precmd not being updated when I want Jesper Holmberg
2003-09-08 20:24 ` Wayne Davison
2003-09-08 20:31 ` Jesper Holmberg
2003-09-08 20:58 ` Wayne Davison
2003-09-09 1:10 ` Bart Schaefer
2003-09-09 7:05 ` Jesper Holmberg
2003-09-09 16:22 ` Bart Schaefer
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).