diff options
author | Joe Rayhawk <jrayhawk@fairlystable.org> | 2025-04-30 02:07:56 -0700 |
---|---|---|
committer | Joe Rayhawk <jrayhawk@fairlystable.org> | 2025-04-30 02:07:56 -0700 |
commit | 26e09889646be3ea65b4a3dfeda26213e4bb6a27 (patch) | |
tree | 4f3c73a9416bf47ad7e125383d23cf42879e38d7 /Src/options.c | |
parent | 841bce705a58b04220b1f257abcc00ae71cbdbdc (diff) | |
parent | 001cba48ce3b964cf01fb3e2af54b20eacbc9bf5 (diff) | |
download | zsh-26e09889646be3ea65b4a3dfeda26213e4bb6a27.tar.gz zsh-26e09889646be3ea65b4a3dfeda26213e4bb6a27.zip |
Merge branch 'upstream' into debian
Diffstat (limited to 'Src/options.c')
-rw-r--r-- | Src/options.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/Src/options.c b/Src/options.c index a1fe918fc..8b13f0c5d 100644 --- a/Src/options.c +++ b/Src/options.c @@ -877,34 +877,37 @@ dosetopt(int optno, int value, int force, char *new_opts) } #endif /* HAVE_SETRESGID && HAVE_SETRESUID */ -#ifdef JOB_CONTROL } else if (!force && optno == MONITOR && value) { if (new_opts[optno] == value) return 0; - if (SHTTY != -1) { + if (SHTTY == -1) + return -1; + if (!origpgrp) { origpgrp = GETPGRP(); acquire_pgrp(); - } else - return -1; -#else - } else if(optno == MONITOR && value) { - return -1; -#endif /* not JOB_CONTROL */ -#ifdef GETPWNAM_FAKED - } else if(optno == CDABLEVARS && value) { - return -1; -#endif /* GETPWNAM_FAKED */ + } } 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; - zleentry(ZLE_CMD_SET_KEYMAP, optno); - new_opts[(optno == EMACSMODE) ? VIMODE : EMACSMODE] = 0; + return opts[optno] ? 0 : -1; + if (zle_load_state == 1) + zleentry(ZLE_CMD_SET_KEYMAP, optno); + new_opts[optno ^ EMACSMODE ^ VIMODE] = 0; } else if (optno == SUNKEYBOARDHACK) { /* for backward compatibility */ keyboardhackchar = (value ? '`' : '\0'); } new_opts[optno] = value; - if (optno == BANGHIST || optno == SHINSTDIN) + if ( +#ifdef MULTIBYTE_SUPPORT + optno == MULTIBYTE || +#endif + optno == BANGHIST || optno == SHINSTDIN) inittyptab(); return 0; } |