* Re: another _arguments problem
@ 2000-02-08 13:55 Sven Wischnowsky
0 siblings, 0 replies; 4+ messages in thread
From: Sven Wischnowsky @ 2000-02-08 13:55 UTC (permalink / raw)
To: zsh-workers
Tanaka Akira wrote:
> Z(2):akr@is27e1u11% Src/zsh -f
> is27e1u11% bindkey -e; autoload -U compinit; compinit -D; compdef _tst tst
> is27e1u11% _tst () { _arguments -a ":desc1:(arg1)" "*::desc2:_tst2" }
> is27e1u11% _tst2 () { compadd $CURRENT }
> is27e1u11% tst arg1 -<TAB>
>
> I think it should insert `a ' but it completes nothing.
>
> Note that zsh inserts a space in a following case.
>
> is27e1u11% tst arg1 -a<TAB>
Oops. Somehow I thought I had taken care of that... but that was for a
slightly different case.
Bye
Sven
diff -ru ../z.old/Src/Zle/computil.c Src/Zle/computil.c
--- ../z.old/Src/Zle/computil.c Tue Feb 8 14:12:07 2000
+++ Src/Zle/computil.c Tue Feb 8 14:52:53 2000
@@ -1006,7 +1006,7 @@
int nopts;
Caarg def, ddef;
Caopt curopt;
- int opt, arg, argbeg, optbeg, nargbeg, restbeg;
+ int opt, arg, argbeg, optbeg, nargbeg, restbeg, curpos;
int inopt, inrest, inarg, nth, doff, singles;
LinkList args;
LinkList *oargs;
@@ -1055,6 +1055,7 @@
state.argbeg = state.optbeg = state.nargbeg = state.restbeg =
state.nth = state.inopt = state.inarg = state.opt = state.arg = 1;
state.inrest = state.doff = state.singles = state.doff = 0;
+ state.curpos = compcurrent;
PERMALLOC {
state.args = newlinklist();
state.oargs = (LinkList *) zalloc(d->nopts * sizeof(LinkList));
@@ -1409,9 +1410,13 @@
}
case 'O':
if ((ca_laststate.opt || (ca_laststate.doff && ca_laststate.def) ||
- (ca_laststate.def && ca_laststate.def->type == CAA_OPT)) &&
+ (ca_laststate.def &&
+ (ca_laststate.def->type == CAA_OPT ||
+ ca_laststate.def->type >= CAA_RARGS))) &&
(!ca_laststate.def || ca_laststate.def->type < CAA_RARGS ||
- compcurrent == 1)) {
+ (ca_laststate.def->type == CAA_RARGS ?
+ (ca_laststate.curpos == ca_laststate.argbeg + 1) :
+ (compcurrent == 1)))) {
LinkList next = newlinklist();
LinkList direct = newlinklist();
LinkList odirect = newlinklist();
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 4+ messages in thread
* another _arguments problem
@ 2000-02-08 13:11 Tanaka Akira
0 siblings, 0 replies; 4+ messages in thread
From: Tanaka Akira @ 2000-02-08 13:11 UTC (permalink / raw)
To: zsh-workers
Z(2):akr@is27e1u11% Src/zsh -f
is27e1u11% bindkey -e; autoload -U compinit; compinit -D; compdef _tst tst
is27e1u11% _tst () { _arguments -a ":desc1:(arg1)" "*::desc2:_tst2" }
is27e1u11% _tst2 () { compadd $CURRENT }
is27e1u11% tst arg1 -<TAB>
I think it should insert `a ' but it completes nothing.
Note that zsh inserts a space in a following case.
is27e1u11% tst arg1 -a<TAB>
--
Tanaka Akira
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Another _arguments problem.
@ 1999-11-02 13:52 Sven Wischnowsky
0 siblings, 0 replies; 4+ messages in thread
From: Sven Wischnowsky @ 1999-11-02 13:52 UTC (permalink / raw)
To: zsh-workers
Tanaka Akira wrote:
> I found another _arguments problem, maybe.
>
> ...
>
> The description for "-V" should be displayed. Because the option "-N"
> takes optional arguments and "V" is treated as an argument for "-N".
Yep. Small off-by-one thinko.
I also found a small display bug with completion lists and two
references to old function names (i.e. uses of functions that have
been renamed). Sorry for the latter, but this machine always complains
about all unknown functions and variables (which are many) so I can't
easily see if there are typos or something like that somewhere. I only
just discovered that it complains about unknown functions when I
unload a module (it doesn't do that when I load the module, oh well...).
I found the display bug when trying `_netscape' and `_urls'. The
latter had some other problems: at one point host names were completed
without a `_description', leaving me with two groups with the same
matches, one with a explanation string, one without. Another problem
was that it used a local parameter `hosts' and `_hosts' then set that,
ignoring the globally set `hosts' parameter. Certainly not the right
thing.
Bye
Sven
diff -u -r oldsrc/Modules/parameter.c Src/Modules/parameter.c
--- oldsrc/Modules/parameter.c Tue Nov 2 13:07:00 1999
+++ Src/Modules/parameter.c Tue Nov 2 14:22:20 1999
@@ -1781,7 +1781,7 @@
static void
scanpmdisgaliases(HashTable ht, ScanFunc func, int flags)
{
- scanpmaliases(ht, func, flags, 1, DISABLED);
+ scanaliases(ht, func, flags, 1, DISABLED);
}
/* Table for defined parameters. */
diff -u -r oldsrc/Zle/compcore.c Src/Zle/compcore.c
--- oldsrc/Zle/compcore.c Tue Nov 2 12:02:10 1999
+++ Src/Zle/compcore.c Tue Nov 2 14:21:48 1999
@@ -334,7 +334,7 @@
while (1) {
if (!first)
- acceptlast();
+ accept_last();
first = 0;
if (!--nm)
diff -u -r oldsrc/Zle/compresult.c Src/Zle/compresult.c
--- oldsrc/Zle/compresult.c Tue Nov 2 12:02:11 1999
+++ Src/Zle/compresult.c Tue Nov 2 14:25:17 1999
@@ -1042,7 +1042,7 @@
} else {
if (oldlist) {
if (oldins && minfo.cur)
- acceptlast();
+ accept_last();
} else
minfo.cur = NULL;
}
@@ -1798,10 +1798,11 @@
q = skipnolist(q + 1);
mc++;
}
- while (i-- > 0)
- printm(g, NULL, mc++, ml, (!i),
+ while (i-- > 0) {
+ printm(g, NULL, mc, ml, (!i),
(g->widths ? g->widths[mc] : g->width), NULL, NULL);
-
+ mc++;
+ }
if (n) {
putc('\n', shout);
ml++;
diff -u -r oldsrc/Zle/computil.c Src/Zle/computil.c
--- oldsrc/Zle/computil.c Tue Nov 2 12:02:11 1999
+++ Src/Zle/computil.c Tue Nov 2 14:41:30 1999
@@ -1035,7 +1035,7 @@
state.optbeg = state.argbeg = state.inopt = cur;
state.singles = (!pe || !*pe);
- for (p = line + 1; p <= pe; p++) {
+ for (p = line + 1; p < pe; p++) {
if ((tmpopt = d->single[STOUC(*p)])) {
PERMALLOC {
state.oargs[tmpopt->num] = newlinklist();
diff -u -r oldcompletion/User/_urls Completion/User/_urls
--- oldcompletion/User/_urls Mon Nov 1 09:03:08 1999
+++ Completion/User/_urls Tue Nov 2 14:33:40 1999
@@ -37,7 +37,7 @@
# name used by a user placing web pages within their home area.
# e.g. compconf urls_localhttp=www:/usr/local/apache/htdocs:public_html
-local ipre scheme host user hosts ret=1 expl
+local ipre scheme host user uhosts ret=1 expl
local urls_path="${compconfig[urls_path]:-${ZDOTDIR:-$HOME}/.zsh/urls}"
local localhttp_servername="${${(@s.:.)compconfig[urls_localhttp]}[1]}"
local localhttp_documentroot="${${(@s.:.)compconfig[urls_localhttp]}[2]}"
@@ -93,10 +93,11 @@
# Complete hosts
if ! compset -P '(#b)([^/]#)/'; then
- hosts=($urls_path/$scheme/$PREFIX*$SUFFIX(/:t))
- (( $#hosts )) || _hosts -S/ && ret=0
- [[ "$scheme" = http ]] && hosts=($hosts $localhttp_servername)
- compadd "$@" -QS/ - $hosts && ret=0
+ uhosts=($urls_path/$scheme/$PREFIX*$SUFFIX(/:t))
+ (( $#uhosts )) || _hosts -S/ && ret=0
+ [[ "$scheme" = http ]] && uhosts=($uhosts $localhttp_servername)
+ _description expl host
+ compadd "$expl[@]" "$@" -QS/ - $uhosts && ret=0
return $ret
fi
host="$match[1]"
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 4+ messages in thread
* Another _arguments problem.
@ 1999-11-02 13:02 Tanaka Akira
0 siblings, 0 replies; 4+ messages in thread
From: Tanaka Akira @ 1999-11-02 13:02 UTC (permalink / raw)
To: zsh-workers
I found another _arguments problem, maybe.
Z(2):akr@is27e1u11% Src/zsh -f
is27e1u11% bindkey -e; fpath=($PWD/Completion/*(/)); autoload -U compinit; compinit -D; compdef _tst tst
is27e1u11% compconf group_matches=yes message_format='%d' description_format='%d'
is27e1u11% compconf describe_options=yes describe_values=yes option_prefix=yes
is27e1u11% archie -LNV -<TAB>
option
-D -- debug level
-O -- specifies offset
-a -- list matches as Alex filenames
-c -- case sensitive substring search
-e -- exact string match (default)
-h -- specifies server host
-l -- list one match per line
-m -- specifies maximum number of hits to return (default 95)
-o -- specifies file to store results in
-r -- regular expression search
-s -- case insensitive substring search
-t -- sort inverted by date
-v -- print version
The description for "-V" should be displayed. Because the option "-N"
takes optional arguments and "V" is treated as an argument for "-N".
--
Tanaka Akira
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2000-02-08 13:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-02-08 13:55 another _arguments problem Sven Wischnowsky
-- strict thread matches above, loose matches on Subject: below --
2000-02-08 13:11 Tanaka Akira
1999-11-02 13:52 Another " Sven Wischnowsky
1999-11-02 13:02 Tanaka Akira
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).