diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c index 9edf30e01..6a491f8b0 100644 --- a/Src/Zle/zle_main.c +++ b/Src/Zle/zle_main.c @@ -83,6 +83,11 @@ int done; /**/ int mark; +/* Zle needs to be refreshed */ + +/**/ +static int zleneedsrefresh; + /* * Status ($?) saved before function entry. This is the * status we need to use in prompts. @@ -1417,6 +1422,8 @@ execzlefunc(Thingy func, char **args, int set_bindk, int set_lbindk) Thingy save_bindk = bindk; Thingy save_lbindk = lbindk; + zleactive++; + if (set_bindk) bindk = func; if (zlemetaline) { @@ -1585,6 +1592,11 @@ execzlefunc(Thingy func, char **args, int set_bindk, int set_lbindk) if (isrepeat) viinrepeat = !invicmdmode(); + if (--zleactive == 1 && zleneedsrefresh) { + zleneedsrefresh = 0; + zrefresh(); + } + return ret; } @@ -2143,7 +2155,10 @@ zle_main_entry(int cmd, va_list ap) break; case ZLE_CMD_REFRESH: - zrefresh(); + if (zleactive > 1) + zleneedsrefresh = 1; + else + zrefresh(); break; case ZLE_CMD_SET_KEYMAP: diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c index d9d9503e2..6b2a8d4d5 100644 --- a/Src/Zle/zle_refresh.c +++ b/Src/Zle/zle_refresh.c @@ -1184,8 +1184,7 @@ zrefresh(void) if (winchanged) { moveto(0, 0); t0 = olnct; /* this is to clear extra lines even when */ - winchanged = 0; /* the terminal cannot TCCLEAREOD */ - listshown = 0; + listshown = 0; /* the terminal cannot TCCLEAREOD */ } #endif /* we probably should only have explicitly set attributes */ @@ -1193,9 +1192,10 @@ zrefresh(void) tsetcap(TCSTANDOUTEND, 0); tsetcap(TCUNDERLINEEND, 0); txtattrmask = 0; - - if (trashedzle && !clearflag) - reexpandprompt(); + if ((trashedzle && !clearflag) || winchanged) { + winchanged = 0; + reexpandprompt(); + } resetvideo(); resetneeded = 0; /* unset */ oput_rpmpt = 0; /* no right-prompt currently on screen */ diff --git a/Src/utils.c b/Src/utils.c index f9127c70c..0154f3112 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -1850,12 +1850,10 @@ mod_export struct ttyinfo shttyinfo; /**/ mod_export int resetneeded; -#ifdef TIOCGWINSZ /* window size changed */ /**/ mod_export int winchanged; -#endif static int adjustlines(int signalled) @@ -1982,11 +1980,7 @@ adjustwinsize(int from) #endif /* TIOCGWINSZ */ if (zleactive && resetzle) { -#ifdef TIOCGWINSZ - winchanged = -#endif /* TIOCGWINSZ */ - resetneeded = 1; - zleentry(ZLE_CMD_RESET_PROMPT); + winchanged = resetneeded = 1; zleentry(ZLE_CMD_REFRESH); } }