mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-11 13:01:28 +02:00
add new sepcial context -assign-parameter- for completing the parameter in an assignment (17387)
This commit is contained in:
parent
6278159f6d
commit
053629183d
8 changed files with 43 additions and 7 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2002-07-01 Sven Wischnowsky <wischnow@zsh.org>
|
||||||
|
|
||||||
|
* 17387: Completion/Zsh/Context/.distfiles,
|
||||||
|
Completion/Zsh/Context/_assign, Doc/Zsh/compsys.yo,
|
||||||
|
Doc/Zsh/compwid.yo, Src/zsh.h, Src/Zle/compcore.c,
|
||||||
|
Src/Zle/zle_tricky.c: add new sepcial context
|
||||||
|
-assign-parameter- for completing the parameter in an
|
||||||
|
assignment
|
||||||
|
|
||||||
2002-06-26 Bart Schaefer <schaefer@zsh.org>
|
2002-06-26 Bart Schaefer <schaefer@zsh.org>
|
||||||
|
|
||||||
* 17357: Src/mkbltnmlst.sh: predefine autoloads for zsh emulation
|
* 17357: Src/mkbltnmlst.sh: predefine autoloads for zsh emulation
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
DISTFILES_SRC='
|
DISTFILES_SRC='
|
||||||
.distfiles
|
.distfiles
|
||||||
_autocd
|
_assign _autocd
|
||||||
_brace_parameter _equal _math _subscript
|
_brace_parameter _equal _math _subscript
|
||||||
_condition _first _parameter _tilde
|
_condition _first _parameter _tilde
|
||||||
_default _in_vared _redirect _value
|
_default _in_vared _redirect _value
|
||||||
|
|
3
Completion/Zsh/Context/_assign
Normal file
3
Completion/Zsh/Context/_assign
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
#compdef -assign-parameter-
|
||||||
|
|
||||||
|
_parameters -g "^*readonly*" -S ''
|
|
@ -2515,6 +2515,10 @@ item(tt(-brace-parameter-))(
|
||||||
for completing the name of a parameter expansion within braces
|
for completing the name of a parameter expansion within braces
|
||||||
(`tt(${...})').
|
(`tt(${...})').
|
||||||
)
|
)
|
||||||
|
kindex(-assign-parameter-, completion context)
|
||||||
|
item(tt(-assign-parameter-))(
|
||||||
|
for completing the name of a parameter in an assignment.
|
||||||
|
)
|
||||||
kindex(-command-, completion context)
|
kindex(-command-, completion context)
|
||||||
item(tt(-command-))(
|
item(tt(-command-))(
|
||||||
for completing in a command position.
|
for completing in a command position.
|
||||||
|
|
|
@ -158,6 +158,9 @@ item(tt(brace_parameter))(
|
||||||
when completing the name of a parameter in a parameter expansion beginning
|
when completing the name of a parameter in a parameter expansion beginning
|
||||||
with tt(${).
|
with tt(${).
|
||||||
)
|
)
|
||||||
|
item(tt(assign_parameter))(
|
||||||
|
when completing the name of a parameter in a parameter assignment.
|
||||||
|
)
|
||||||
item(tt(command))(
|
item(tt(command))(
|
||||||
when completing for a normal command (either in command position or for
|
when completing for a normal command (either in command position or for
|
||||||
an argument of the command).
|
an argument of the command).
|
||||||
|
|
|
@ -553,6 +553,8 @@ callcompfunc(char *s, char *fn)
|
||||||
compparameter = compredirect = "";
|
compparameter = compredirect = "";
|
||||||
if (ispar)
|
if (ispar)
|
||||||
compcontext = (ispar == 2 ? "brace_parameter" : "parameter");
|
compcontext = (ispar == 2 ? "brace_parameter" : "parameter");
|
||||||
|
else if (linwhat == IN_PAR)
|
||||||
|
compcontext = "assign_parameter";
|
||||||
else if (linwhat == IN_MATH) {
|
else if (linwhat == IN_MATH) {
|
||||||
if (insubscr) {
|
if (insubscr) {
|
||||||
compcontext = "subscript";
|
compcontext = "subscript";
|
||||||
|
|
|
@ -1256,12 +1256,25 @@ get_comp_string(void)
|
||||||
insubscr = 2;
|
insubscr = 2;
|
||||||
else
|
else
|
||||||
insubscr = 1;
|
insubscr = 1;
|
||||||
} else if (*s == '=' && cs > wb + (s - tt)) {
|
} else if (*s == '=') {
|
||||||
|
if (cs > wb + (s - tt)) {
|
||||||
s++;
|
s++;
|
||||||
wb += s - tt;
|
wb += s - tt;
|
||||||
t0 = STRING;
|
|
||||||
s = ztrdup(s);
|
s = ztrdup(s);
|
||||||
inwhat = IN_ENV;
|
inwhat = IN_ENV;
|
||||||
|
} else {
|
||||||
|
char *p = s;
|
||||||
|
|
||||||
|
if (p[-1] == '+')
|
||||||
|
p--;
|
||||||
|
sav = *p;
|
||||||
|
*p = '\0';
|
||||||
|
inwhat = IN_PAR;
|
||||||
|
s = ztrdup(tt);
|
||||||
|
*p = sav;
|
||||||
|
we = wb + p - tt;
|
||||||
|
}
|
||||||
|
t0 = STRING;
|
||||||
}
|
}
|
||||||
lincmd = 1;
|
lincmd = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1318,6 +1318,8 @@ struct histent {
|
||||||
#define IN_COND 3
|
#define IN_COND 3
|
||||||
/* In a parameter assignment (e.g. `foo=bar'). */
|
/* In a parameter assignment (e.g. `foo=bar'). */
|
||||||
#define IN_ENV 4
|
#define IN_ENV 4
|
||||||
|
/* In a parameter name in an assignment. */
|
||||||
|
#define IN_PAR 5
|
||||||
|
|
||||||
|
|
||||||
/******************************/
|
/******************************/
|
||||||
|
|
Loading…
Reference in a new issue