diff options
author | Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp> | 2022-11-02 16:27:27 +0900 |
---|---|---|
committer | Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp> | 2022-11-02 16:27:27 +0900 |
commit | f8d93888a8efd6c8142e74ece83b38632661de47 (patch) | |
tree | 71a804635690405184aca5f330777c5c59c2e60b /Src/exec.c | |
parent | 7a2e3b9039a866ad0b45a70b498fad1ae5ad7de7 (diff) | |
download | zsh-f8d93888a8efd6c8142e74ece83b38632661de47.tar.gz zsh-f8d93888a8efd6c8142e74ece83b38632661de47.tar.xz zsh-f8d93888a8efd6c8142e74ece83b38632661de47.zip |
50851: restore typtab when necessary
inittyptab() must be called when returning from a function with "setopt localoptions MULTIBYTE|BANGHIST|SHSTDIN", and also in function dosetopt() when setting these options (via $options, for example). We intentionally did not take account of the options EMACS/VI because these options are obsolete and their use is not recommended.
Diffstat (limited to 'Src/exec.c')
-rw-r--r-- | Src/exec.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Src/exec.c b/Src/exec.c index f2911807c..c8bcf4ee5 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -5961,11 +5961,23 @@ doshfunc(Shfunc shfunc, LinkList doshargs, int noreturnval) emulation = funcsave->emulation; sticky = funcsave->sticky; } else if (isset(LOCALOPTIONS)) { + /* we need to call inittyptab() if these options change */ + int init_typtab = +#ifdef MULTIBYTE_SUPPORT + funcsave->opts[MULTIBYTE] != opts[MULTIBYTE] || +#endif + funcsave->opts[BANGHIST] != opts[BANGHIST] || + funcsave->opts[SHINSTDIN] != opts[SHINSTDIN]; + /* take care of SUNKEYBOARDHACK but not of EMACS/VI */ + if (funcsave->opts[SUNKEYBOARDHACK] != opts[SUNKEYBOARDHACK]) + keyboardhackchar = funcsave->opts[SUNKEYBOARDHACK] ? '`' : '\0'; /* restore all shell options except PRIVILEGED and RESTRICTED */ funcsave->opts[PRIVILEGED] = opts[PRIVILEGED]; funcsave->opts[RESTRICTED] = opts[RESTRICTED]; memcpy(opts, funcsave->opts, sizeof(opts)); emulation = funcsave->emulation; + if (init_typtab) + inittyptab(); } else { /* just restore a couple. */ opts[XTRACE] = funcsave->opts[XTRACE]; |