mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-06-09 16:56:04 +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
|
@ -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>
|
||||
|
||||
* 17357: Src/mkbltnmlst.sh: predefine autoloads for zsh emulation
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
DISTFILES_SRC='
|
||||
.distfiles
|
||||
_autocd
|
||||
_assign _autocd
|
||||
_brace_parameter _equal _math _subscript
|
||||
_condition _first _parameter _tilde
|
||||
_default _in_vared _redirect _value
|
||||
|
|
|
@ -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
|
||||
(`tt(${...})').
|
||||
)
|
||||
kindex(-assign-parameter-, completion context)
|
||||
item(tt(-assign-parameter-))(
|
||||
for completing the name of a parameter in an assignment.
|
||||
)
|
||||
kindex(-command-, completion context)
|
||||
item(tt(-command-))(
|
||||
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
|
||||
with tt(${).
|
||||
)
|
||||
item(tt(assign_parameter))(
|
||||
when completing the name of a parameter in a parameter assignment.
|
||||
)
|
||||
item(tt(command))(
|
||||
when completing for a normal command (either in command position or for
|
||||
an argument of the command).
|
||||
|
|
|
@ -553,6 +553,8 @@ callcompfunc(char *s, char *fn)
|
|||
compparameter = compredirect = "";
|
||||
if (ispar)
|
||||
compcontext = (ispar == 2 ? "brace_parameter" : "parameter");
|
||||
else if (linwhat == IN_PAR)
|
||||
compcontext = "assign_parameter";
|
||||
else if (linwhat == IN_MATH) {
|
||||
if (insubscr) {
|
||||
compcontext = "subscript";
|
||||
|
|
|
@ -1256,12 +1256,25 @@ get_comp_string(void)
|
|||
insubscr = 2;
|
||||
else
|
||||
insubscr = 1;
|
||||
} else if (*s == '=' && cs > wb + (s - tt)) {
|
||||
s++;
|
||||
wb += s - tt;
|
||||
t0 = STRING;
|
||||
s = ztrdup(s);
|
||||
inwhat = IN_ENV;
|
||||
} else if (*s == '=') {
|
||||
if (cs > wb + (s - tt)) {
|
||||
s++;
|
||||
wb += s - tt;
|
||||
s = ztrdup(s);
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue