From bd70d684fcf40ff1fba07ec69bd08e1ce40cbd2f Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Mon, 12 May 2008 13:50:42 +0000 Subject: 25002: only ZLE should update attributes resulting from prompt expansion --- Src/Zle/zle_main.c | 19 ++++++++++--------- Src/Zle/zle_refresh.c | 3 ++- 2 files changed, 12 insertions(+), 10 deletions(-) (limited to 'Src/Zle') diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c index 804661ac6..7fb6878da 100644 --- a/Src/Zle/zle_main.c +++ b/Src/Zle/zle_main.c @@ -1115,7 +1115,8 @@ zleread(char **lp, char **rp, int flags, int context) char *pptbuf; int pptlen; - pptbuf = unmetafy(promptexpand(lp ? *lp : NULL, 0, NULL, NULL), + pptbuf = unmetafy(promptexpand(lp ? *lp : NULL, 0, NULL, NULL, + &pmpt_attr), &pptlen); write(2, (WRITE_ARG_2_T)pptbuf, pptlen); free(pptbuf); @@ -1145,11 +1146,10 @@ zleread(char **lp, char **rp, int flags, int context) fetchttyinfo = 0; trashedzle = 0; raw_lp = lp; - lpromptbuf = promptexpand(lp ? *lp : NULL, 1, NULL, NULL); - pmpt_attr = txtchange; + lpromptbuf = promptexpand(lp ? *lp : NULL, 1, NULL, NULL, &pmpt_attr); raw_rp = rp; - rpromptbuf = promptexpand(rp ? *rp : NULL, 1, NULL, NULL); - rpmpt_attr = txtchange; + rpmpt_attr = pmpt_attr; + rpromptbuf = promptexpand(rp ? *rp : NULL, 1, NULL, NULL, &rpmpt_attr); free_prepostdisplay(); zlereadflags = flags; @@ -1725,11 +1725,12 @@ reexpandprompt(void) if (!reexpanding++) { free(lpromptbuf); - lpromptbuf = promptexpand(raw_lp ? *raw_lp : NULL, 1, NULL, NULL); - pmpt_attr = txtchange; + lpromptbuf = promptexpand(raw_lp ? *raw_lp : NULL, 1, NULL, NULL, + &pmpt_attr); + rpmpt_attr = pmpt_attr; free(rpromptbuf); - rpromptbuf = promptexpand(raw_rp ? *raw_rp : NULL, 1, NULL, NULL); - rpmpt_attr = txtchange; + rpromptbuf = promptexpand(raw_rp ? *raw_rp : NULL, 1, NULL, NULL, + &rpmpt_attr); } reexpanding--; } diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c index dd8c26079..f43ad45e2 100644 --- a/Src/Zle/zle_refresh.c +++ b/Src/Zle/zle_refresh.c @@ -990,12 +990,13 @@ zrefresh(void) int tmppos; /* t - tmpline */ int tmpalloced; /* flag to free tmpline when finished */ int remetafy; /* flag that zle line is metafied */ + int txtchange; /* attributes set after prompts */ struct rparams rpms; #ifdef MULTIBYTE_SUPPORT int width; /* width of wide character */ #endif - + /* If this is called from listmatches() (indirectly via trashzle()), and * * that was called from the end of zrefresh(), then we don't need to do * * anything. All this `inlist' code is actually unnecessary, but it * -- cgit 1.4.1