diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | Src/Zle/zle_main.c | 23 |
2 files changed, 29 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog index 59540b4d6..741cc9a62 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-07-31 Peter Stephenson <p.w.stephenson@ntlworld.com> + + * users/15217: Src/Zle/zle_main.c: use top-level status + when redrawing prompt. + 2010-07-30 Frank Terbeck <ft@bewatermyfriend.org> * Mikael Magnusson: 28110: Doc/Zsh/compsys.yo: Fix yodl warning. @@ -13452,5 +13457,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5040 $ +* $Revision: 1.5041 $ ***************************************************** diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c index 16f98186f..5c6b65db3 100644 --- a/Src/Zle/zle_main.c +++ b/Src/Zle/zle_main.c @@ -84,6 +84,14 @@ int done; int mark; /* + * Status ($?) saved before function entry. This is the + * status we need to use in prompts. + */ + +/**/ +static int pre_zle_status; + +/* * Last character pressed. * * Depending how far we are with processing, the lastcharacter may @@ -1129,6 +1137,12 @@ zleread(char **lp, char **rp, int flags, int context) free(pptbuf); return shingetline(); } + /* + * The current status is what we need if we are going + * to display a prompt. We'll remember it here for + * use further in. + */ + pre_zle_status = lastval; keytimeout = (time_t)getiparam("KEYTIMEOUT"); if (!shout) { @@ -1756,6 +1770,14 @@ reexpandprompt(void) static int reexpanding; if (!reexpanding++) { + /* + * If we're displaying a status in the prompt, it + * needs to be the toplevel one, not the one from + * any status set within the local zle function. + */ + int local_lastval = lastval; + lastval = pre_zle_status; + free(lpromptbuf); lpromptbuf = promptexpand(raw_lp ? *raw_lp : NULL, 1, NULL, NULL, &pmpt_attr); @@ -1763,6 +1785,7 @@ reexpandprompt(void) free(rpromptbuf); rpromptbuf = promptexpand(raw_rp ? *raw_rp : NULL, 1, NULL, NULL, &rpmpt_attr); + lastval = local_lastval; } reexpanding--; } |