diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | Src/options.c | 8 |
2 files changed, 11 insertions, 1 deletions
@@ -1,3 +1,7 @@ +2025-03-02 Bart Schaefer <schaefer@toltec-ubuntu> + + * 53368: Src/options.c: ignore no-op changes to EMACS/VI options + 2025-02-28 Oliver Kiddle <opk@zsh.org> * 53395: Completion/Unix/Type/_zfs_dataset, 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) { |