diff options
author | Peter Stephenson <p.w.stephenson@ntlworld.com> | 2015-10-26 10:00:54 +0000 |
---|---|---|
committer | Peter Stephenson <p.w.stephenson@ntlworld.com> | 2015-10-26 10:00:54 +0000 |
commit | 11ca38c6d99192856d33254c504114d4ba8cd258 (patch) | |
tree | 9c8269d5b0df54a190e91f90d80d4dc705393d20 /Src/Zle | |
parent | 8b5158424637834f242bb1e2114dee4ac7cca328 (diff) | |
download | zsh-11ca38c6d99192856d33254c504114d4ba8cd258.tar.gz zsh-11ca38c6d99192856d33254c504114d4ba8cd258.tar.xz zsh-11ca38c6d99192856d33254c504114d4ba8cd258.zip |
users/20825: fix crash when complex completion hooks.
get_undo_current_change() needs protecting against execution in completion environment.
Diffstat (limited to 'Src/Zle')
-rw-r--r-- | Src/Zle/zle_utils.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c index 714d911a6..ffff8fd1c 100644 --- a/Src/Zle/zle_utils.c +++ b/Src/Zle/zle_utils.c @@ -1739,9 +1739,26 @@ zlecallhook(char *name, char *arg) zlong get_undo_current_change(UNUSED(Param pm)) { + int remetafy; + + /* + * Yuk: we call this from within the completion system, + * so we need to convert back to the form which can be + * copied into undo entries. + */ + if (zlemetaline != NULL) { + unmetafy_line(); + remetafy = 1; + } else + remetafy = 0; + /* add entry for any pending changes */ mkundoent(); setlastline(); + + if (remetafy) + metafy_line(); + return undo_changeno; } |