diff options
Diffstat (limited to 'Src/Zle/zle_main.c')
-rw-r--r-- | Src/Zle/zle_main.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c index 904bf148e..5751d5329 100644 --- a/Src/Zle/zle_main.c +++ b/Src/Zle/zle_main.c @@ -1509,10 +1509,15 @@ recursiveedit(UNUSED(char **args)) void reexpandprompt(void) { - free(lpromptbuf); - lpromptbuf = promptexpand(raw_lp ? *raw_lp : NULL, 1, NULL, NULL); - free(rpromptbuf); - rpromptbuf = promptexpand(raw_rp ? *raw_rp : NULL, 1, NULL, NULL); + static reexpanding; + + if (!reexpanding++) { + free(lpromptbuf); + lpromptbuf = promptexpand(raw_lp ? *raw_lp : NULL, 1, NULL, NULL); + free(rpromptbuf); + rpromptbuf = promptexpand(raw_rp ? *raw_rp : NULL, 1, NULL, NULL); + } + reexpanding--; } /**/ |