diff options
author | Bart Schaefer <schaefer@zsh.org> | 2025-03-02 11:23:22 -0800 |
---|---|---|
committer | Bart Schaefer <schaefer@zsh.org> | 2025-03-02 11:23:22 -0800 |
commit | d315401a032cfada4ff733b20d708a5e76d75e48 (patch) | |
tree | 01908c4ae958f529c9a2752febc4ae977be1fc6b /Src | |
parent | eb8e217f1ba41c2146218bc74643a48c1a82d8b9 (diff) | |
download | zsh-d315401a032cfada4ff733b20d708a5e76d75e48.tar.gz zsh-d315401a032cfada4ff733b20d708a5e76d75e48.zip |
53368: ignore no-op changes to EMACS/VI options
Diffstat (limited to 'Src')
-rw-r--r-- | Src/options.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Src/options.c b/Src/options.c index 8b37ab5e8..696ab5c69 100644 --- a/Src/options.c +++ b/Src/options.c @@ -887,8 +887,14 @@ dosetopt(int optno, int value, int force, char *new_opts) acquire_pgrp(); } } else if ((optno == EMACSMODE || optno == VIMODE) && value) { + /* What's going on here: + * 1) unsetopt of either emacs or vi is an effective no-op. + * 2) setopt of either emacs or vi toggles off the other. + * Hence we disallow changing these options in emulation mode, + * but only if the change is setopt rather than unsetopt. + */ if (sticky && sticky->emulation) - return -1; + return opts[optno] ? 0 : -1; zleentry(ZLE_CMD_SET_KEYMAP, optno); new_opts[(optno == EMACSMODE) ? VIMODE : EMACSMODE] = 0; } else if (optno == SUNKEYBOARDHACK) { |