diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2003-05-15 09:23:08 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2003-05-15 09:23:08 +0000 |
commit | 4e309d2cddb7b8e1ee7c57320ba4a87162e943bf (patch) | |
tree | c36f194a9bcbde770a00d39bb9618552e3f94cbd | |
parent | 62719196b27496c3cc4ff97a92fc03627b1bab38 (diff) | |
download | zsh-4e309d2cddb7b8e1ee7c57320ba4a87162e943bf.tar.gz zsh-4e309d2cddb7b8e1ee7c57320ba4a87162e943bf.tar.xz zsh-4e309d2cddb7b8e1ee7c57320ba4a87162e943bf.zip |
18539 and remaining bits of 18536???: vi and emacs options, autoload zle
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | Src/init.c | 13 | ||||
-rw-r--r-- | Src/options.c | 5 |
3 files changed, 27 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog index b2b183c24..5550e3a02 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ +2003-05-15 Peter Stephenson <pws@csr.com> + + * 18539: Src/init.c: upgrade 18536 to autoload zle on + `set -o vi' or `set -o emacs'. + 2003-05-14 Peter Stephenson <pws@csr.com> + * 18536: Doc/Zsh/options.yo, Src/init.c, Src/options.c, + Src/zsh.h, Src/Zle/zle_keymap.c, Src/Zle/zle_main.c: + Add EMACS and VI options for POSIX-style + keymap changes; only implemented for compatibility. + * Jonathan Paisley <jp-www@dcs.gla.ac.uk>: 18513: Src/Zle/complist.c: Work around a bad pointer access after resizing the terminal in menu selection. diff --git a/Src/init.c b/Src/init.c index 06558e918..96558f84b 100644 --- a/Src/init.c +++ b/Src/init.c @@ -1122,11 +1122,12 @@ mod_export ZleVoidFn refreshptr = noop_function; mod_export ZleVoidIntFn spaceinlineptr = noop_function_int; # ifdef UNLINKED_XMOD_zshQszle mod_export ZleReadFn zlereadptr = autoload_zleread; +mod_export ZleVoidIntFn zlesetkeymapptr = autoload_zlesetkeymap; # else /* !UNLINKED_XMOD_zshQszle */ mod_export ZleReadFn zlereadptr = fallback_zleread; +mod_export ZleVoidIntFn zlesetkeymapptr = noop_function_int; # endif /* !UNLINKED_XMOD_zshQszle */ -mod_export ZleVoidIntFn zlesetkeymapptr = noop_function_int; #endif /* !LINKED_XMOD_zshQszle */ /**/ @@ -1153,6 +1154,16 @@ fallback_zleread(char *lp, char *rp, int ha) return (unsigned char *)shingetline(); } +/**/ +static void +autoload_zlesetkeymap(int mode) +{ + zlesetkeymapptr = noop_function_int; + load_module("zsh/zle"); + (*zlesetkeymapptr)(mode); +} + + /* compctl entry point pointers. Similar to the ZLE ones. */ /**/ diff --git a/Src/options.c b/Src/options.c index da1e9efac..f206d0ab3 100644 --- a/Src/options.c +++ b/Src/options.c @@ -107,6 +107,7 @@ static struct optname optns[] = { {NULL, "cshjunkiequotes", OPT_EMULATE|OPT_CSH, CSHJUNKIEQUOTES}, {NULL, "cshnullcmd", OPT_EMULATE|OPT_CSH, CSHNULLCMD}, {NULL, "cshnullglob", OPT_EMULATE|OPT_CSH, CSHNULLGLOB}, +{NULL, "emacs", 0, EMACSMODE}, {NULL, "equals", OPT_EMULATE|OPT_ZSH, EQUALS}, {NULL, "errexit", OPT_EMULATE, ERREXIT}, {NULL, "errreturn", OPT_EMULATE, ERRRETURN}, @@ -204,6 +205,7 @@ static struct optname optns[] = { {NULL, "typesetsilent", OPT_EMULATE|OPT_BOURNE, TYPESETSILENT}, {NULL, "unset", OPT_EMULATE|OPT_BSHELL, UNSET}, {NULL, "verbose", 0, VERBOSE}, +{NULL, "vi", 0, VIMODE}, {NULL, "xtrace", 0, XTRACE}, {NULL, "zle", OPT_SPECIAL, USEZLE}, {NULL, "braceexpand", OPT_ALIAS, /* ksh/bash */ -IGNOREBRACES}, @@ -679,6 +681,9 @@ dosetopt(int optno, int value, int force) } else if(optno == CDABLEVARS && value) { return -1; #endif /* GETPWNAM_FAKED */ + } else if ((optno == EMACSMODE || optno == VIMODE) && value) { + (*zlesetkeymapptr)(optno); + opts[(optno == EMACSMODE) ? VIMODE : EMACSMODE] = 0; } opts[optno] = value; if (optno == BANGHIST || optno == SHINSTDIN) |