mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-04 22:51:42 +02:00
43084: Variable warning suppression enhancements.
Add vared -g option along the lines of typeset -g. Set reply safely in zsh_directory_name_cdr.
This commit is contained in:
parent
3c57f71668
commit
0a6cb5078d
4 changed files with 17 additions and 8 deletions
|
@ -1,3 +1,9 @@
|
|||
2018-06-25 Peter Stephenson <p.stephenson@samsung.com>
|
||||
|
||||
* 43084: Doc/Zsh/zle.yo, Functions/Chpwd/zsh_directory_name_cdr,
|
||||
Src/Zle/zle_main.c: vared -g suppresses variable creation and
|
||||
override warnings; also suppress in function.
|
||||
|
||||
2018-06-25 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
|
||||
|
||||
* 43079, 43086: Completion/Unix/Type/_process_names,
|
||||
|
|
|
@ -342,7 +342,7 @@ findex(vared)
|
|||
cindex(parameters, editing)
|
||||
cindex(editing parameters)
|
||||
redef(SPACES)(0)(tt(ifztexi(NOTRANS(@ @ @ @ @ @ ))ifnztexi( )))
|
||||
xitem(tt(vared )[ tt(-Aache) ] [ tt(-p) var(prompt) ] [ tt(-r) var(rprompt) ])
|
||||
xitem(tt(vared )[ tt(-Aacghe) ] [ tt(-p) var(prompt) ] [ tt(-r) var(rprompt) ])
|
||||
xitem(SPACES()[ tt(-M) var(main-keymap) ] [ tt(-m) var(vicmd-keymap) ])
|
||||
xitem(SPACES()[ tt(-i) var(init-widget) ] [ tt(-f) var(finish-widget) ])
|
||||
item(SPACES()[ tt(-t) var(tty) ] var(name))(
|
||||
|
@ -353,7 +353,9 @@ When the tt(-c) flag is given, the parameter is created if it doesn't
|
|||
already exist. The tt(-a) flag may be given with tt(-c) to create
|
||||
an array parameter, or the tt(-A) flag to create an associative array.
|
||||
If the type of an existing parameter does not match the type to be
|
||||
created, the parameter is unset and recreated.
|
||||
created, the parameter is unset and recreated. The tt(-g) flag may
|
||||
be given to suppress warnings from the tt(WARN_CREATE_GLOBAL)
|
||||
and tt(WARN_NESTED_VAR) options.
|
||||
|
||||
If an array or array slice is being edited, separator characters as defined
|
||||
in tt($IFS) will be shown quoted with a backslash, as will backslashes
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
if [[ $1 = n ]]; then
|
||||
if [[ $2 = <-> ]]; then
|
||||
# Recent directory
|
||||
typeset -ga reply
|
||||
autoload -Uz cdr
|
||||
cdr -r
|
||||
if [[ -n ${reply[$2]} ]]; then
|
||||
reply=(${reply[$2]})
|
||||
typeset -ga reply=(${reply[$2]})
|
||||
return 0
|
||||
else
|
||||
reply=()
|
||||
typeset -ga reply=()
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -1652,6 +1652,7 @@ bin_vared(char *name, char **args, Options ops, UNUSED(int func))
|
|||
Param pm = 0;
|
||||
int ifl;
|
||||
int type = PM_SCALAR, obreaks = breaks, haso = 0, oSHTTY = 0;
|
||||
int warn_flags;
|
||||
char *p1, *p2, *main_keymapname, *vicmd_keymapname, *init, *finish;
|
||||
Keymap main_keymapsave = NULL, vicmd_keymapsave = NULL;
|
||||
FILE *oshout = NULL;
|
||||
|
@ -1665,6 +1666,7 @@ bin_vared(char *name, char **args, Options ops, UNUSED(int func))
|
|||
return 1;
|
||||
}
|
||||
|
||||
warn_flags = OPT_ISSET(ops, 'g') ? 0 : ASSPM_WARN;
|
||||
if (OPT_ISSET(ops,'A'))
|
||||
{
|
||||
if (OPT_ISSET(ops, 'a'))
|
||||
|
@ -1845,11 +1847,11 @@ bin_vared(char *name, char **args, Options ops, UNUSED(int func))
|
|||
a = spacesplit(t, 1, 0, 1);
|
||||
zsfree(t);
|
||||
if (PM_TYPE(pm->node.flags) == PM_ARRAY)
|
||||
setaparam(args[0], a);
|
||||
assignaparam(args[0], a, warn_flags);
|
||||
else
|
||||
sethparam(args[0], a);
|
||||
} else
|
||||
setsparam(args[0], t);
|
||||
assignsparam(args[0], t, warn_flags);
|
||||
unqueue_signals();
|
||||
return 0;
|
||||
}
|
||||
|
@ -2148,7 +2150,7 @@ zle_main_entry(int cmd, va_list ap)
|
|||
|
||||
static struct builtin bintab[] = {
|
||||
BUILTIN("bindkey", 0, bin_bindkey, 0, -1, 0, "evaM:ldDANmrsLRp", NULL),
|
||||
BUILTIN("vared", 0, bin_vared, 1, 1, 0, "aAcef:hi:M:m:p:r:t:", NULL),
|
||||
BUILTIN("vared", 0, bin_vared, 1, 1, 0, "aAcef:ghi:M:m:p:r:t:", NULL),
|
||||
BUILTIN("zle", 0, bin_zle, 0, -1, 0, "aAcCDfFgGIKlLmMNrRTUw", NULL),
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue