18539 and remaining bits of 18536???: vi and emacs options, autoload zle

This commit is contained in:
Peter Stephenson 2003-05-15 09:23:08 +00:00
parent 62719196b2
commit 4e309d2cdd
3 changed files with 27 additions and 1 deletions

View file

@ -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.

View file

@ -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. */
/**/

View file

@ -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)