* Re: Problems with _arguments
@ 1999-10-18 8:56 Sven Wischnowsky
0 siblings, 0 replies; 2+ messages in thread
From: Sven Wischnowsky @ 1999-10-18 8:56 UTC (permalink / raw)
To: zsh-workers
Andrej Borsenkow wrote:
> This little completion stopped to work. I suspect new computil module ...
Yep. The main problem was that I forgot to save the parsing state in
with restricting rest-argument-definitions.
Bye
Sven
diff -u oldsrc/Zle/computil.c Src/Zle/computil.c
--- oldsrc/Zle/computil.c Mon Oct 18 10:38:44 1999
+++ Src/Zle/computil.c Mon Oct 18 10:53:48 1999
@@ -1043,24 +1043,28 @@
if (!state.def)
state.curopt = NULL;
} else if (state.arg) {
- PERMALLOC {
- addlinknode(state.args, ztrdup(line));
- } LASTALLOC;
+ if (state.inopt) {
+ state.inopt = 0;
+ state.nargbeg = cur - 1;
+ }
if ((adef = state.def = ca_get_arg(d, state.nth)) &&
(state.def->type == CAA_RREST ||
state.def->type == CAA_RARGS)) {
state.inrest = 0;
+ state.argbeg = cur;
for (; line; line = compwords[cur++]) {
PERMALLOC {
addlinknode(state.args, ztrdup(line));
} LASTALLOC;
}
+ memcpy(&ca_laststate, &state, sizeof(state));
+ ca_laststate.ddef = NULL;
+ ca_laststate.doff = 0;
break;
}
- if (state.inopt) {
- state.inopt = 0;
- state.nargbeg = cur - 1;
- }
+ PERMALLOC {
+ addlinknode(state.args, ztrdup(line));
+ } LASTALLOC;
if (state.def && state.def->type != CAA_NORMAL &&
state.def->type != CAA_OPT && state.inarg) {
state.restbeg = cur;
@@ -1083,6 +1087,9 @@
addlinknode(l, line);
} LASTALLOC;
}
+ memcpy(&ca_laststate, &state, sizeof(state));
+ ca_laststate.ddef = NULL;
+ ca_laststate.doff = 0;
break;
}
}
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 2+ messages in thread
* Problems with _arguments
@ 1999-10-15 15:06 Andrej Borsenkow
0 siblings, 0 replies; 2+ messages in thread
From: Andrej Borsenkow @ 1999-10-15 15:06 UTC (permalink / raw)
To: ZSH workers mailing list
This little completion stopped to work. I suspect new computil module ...
Anything as simple as
sudo umo<TAB> (implying umount) or
sudo ls S<TAB> (where S* exists 'course)
#compdef sudo
_arguments \
'-V[show version]' \
'-l[list commands]' \
'-h[show help]' \
'-v[validate timestamp file]' \
'-k[remove timestamp file]' \
'-b[run command in background]' \
'-r:Kerberos realm:' \
'-p:prompt:' \
'-u:user name:_users' \
'-s[run SHELL]' \
'-H[set HOME environment variable]' \
'*::complete command and/or arguments:_normal'
/andrej
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1999-10-18 8:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-10-18 8:56 Problems with _arguments Sven Wischnowsky
-- strict thread matches above, loose matches on Subject: below --
1999-10-15 15:06 Andrej Borsenkow
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).