From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: PATCH: _archie
Date: Thu, 21 Oct 1999 10:32:40 +0200 (MET DST) [thread overview]
Message-ID: <199910210832.KAA32127@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Tanaka Akira's message of 21 Oct 1999 01:15:03 +0900
Tanaka Akira wrote:
> Sven Wischnowsky <wischnow@informatik.hu-berlin.de> writes:
>
> > Combination of `computil' not reporting that options are allowed at
> > that position and a bit of stupidity in `_arguments'.
>
> Thanks. First <TAB> works well now. But second <TAB> doesn't.
>
> ...
>
> I think second <TAB> should insert "D" to command line, but zsh
> doesn't insert anything.
That was caused by `_arguments' invoking `_message' too early. That
added an empty string as a match and set `compstate[insert]' to an
empty string -- which then inhibitied the start of menucompletion.
> (1) flex -<TAB> show the option "+" incorrectly.
Parsing bug in `computil'. It took it as one of those both-`-'-and`+'-
options.
> (2) bison <TAB> doesn't complete files at all.
>
> is27e1u11% bison <TAB>
>
> In pws-6, it completes files in current directory.
>
> # I found that _bison doesn't treat *.y specialy...
> # It should be treated as well as *.(yacc|bison).
It completed files for me, so I've just added the `*.y' case. Maybe
you tried it without 8340?
> (3) bison Sr<TAB> completes option letters after "Sr"
Ouch. The code didn't test for the leading `[-+]' so it thought it had
found `-r'.
> (4) cvs add <TAB> completes cvs commands.
This is to be fixed by 8340.
Bye
Sven
diff -u oldsrc/Zle/computil.c Src/Zle/computil.c
--- oldsrc/Zle/computil.c Thu Oct 21 08:59:16 1999
+++ Src/Zle/computil.c Thu Oct 21 10:28:49 1999
@@ -583,8 +583,10 @@
if ((multi = (*p == '*')))
p++;
- if ((p[0] == '-' && p[1] == '+') ||
- (p[0] == '+' && p[1] == '-')) {
+ if (((p[0] == '-' && p[1] == '+') ||
+ (p[0] == '+' && p[1] == '-')) &&
+ p[2] && p[2] != ':' && p[2] != '[' &&
+ p[2] != '=' && p[2] != '-' && p[2] != '+') {
name = ++p;
*p = (again ? '-' : '+');
again = 1 - again;
@@ -593,7 +595,12 @@
if (p[0] == '-' && p[1] == '-')
p++;
}
- for (p++; *p && *p != ':' && *p != '[' &&
+ if (!p[1]) {
+ free_cadef(ret);
+ zerrnam(nam, "invalid argument: %s", *args, 0);
+ return NULL;
+ }
+ for (p += 2; *p && *p != ':' && *p != '[' &&
((*p != '-' && *p != '+' && *p != '=') ||
(p[1] != ':' && p[1] != '[')); p++)
if (*p == '\\' && p[1])
@@ -834,8 +841,7 @@
ca_get_sopt(Cadef d, char *line, int full, char **end)
{
Caopt p;
-
- line++;
+ char pre = *line++;
if (full) {
for (p = NULL; *line; line++)
@@ -846,7 +852,7 @@
} else {
for (p = NULL; *line; line++)
if ((p = d->single[STOUC(*line)]) && p->active &&
- p->args && p->type != CAO_NEXT) {
+ p->args && p->type != CAO_NEXT && p->name[0] == pre) {
if (end) {
line++;
if (p->type == CAO_EQUAL && *line == '=')
@@ -854,9 +860,12 @@
*end = line;
}
break;
- } else if (!p || !p->active || (line[1] && p->args))
+ } else if (!p || !p->active || (line[1] && p->args) ||
+ p->name[0] != pre)
return NULL;
- if (end)
+ else
+ p = NULL;
+ if (p && end)
*end = line;
return p;
}
diff -u -r oldcompletion/Base/_arguments Completion/Base/_arguments
--- oldcompletion/Base/_arguments Thu Oct 21 08:58:54 1999
+++ Completion/Base/_arguments Thu Oct 21 09:21:03 1999
@@ -5,7 +5,7 @@
setopt localoptions extendedglob
-local long cmd="$words[1]" descr
+local long cmd="$words[1]" descr mesg
long=$argv[(I)--]
if (( long )); then
@@ -189,7 +189,7 @@
# An empty action means that we should just display a message.
[[ -n "$matched" ]] && compadd -n -Q -S '' -s "$SUFFIX" - "$PREFIX"
- _message "$descr"
+ mesg="$descr"
elif [[ "$action" = \(\(*\)\) ]]; then
@@ -286,6 +286,7 @@
[[ -n "$aret" ]] && return 300
+ [[ -n "$mesg" ]] && _message "$mesg"
[[ -n "$noargs" ]] && _message "$noargs"
# Set the return value.
diff -u -r oldcompletion/User/_bison Completion/User/_bison
--- oldcompletion/User/_bison Thu Oct 21 08:59:03 1999
+++ Completion/User/_bison Thu Oct 21 10:15:44 1999
@@ -14,7 +14,7 @@
'(--version)-V[show version]' \
'(--help)-h[show help]' \
'(--yacc --fixed-output-file)-y[imitate yacc'"'"'s output file convention]' \
- ':input file:_files -g \*.\(\#i\)\(bison\|yacc\)' \
+ ':input file:_files -g \*.\(\#i\)\(bison\|yacc\|y\)' \
-- \
'*=outfile:parser file name:_files' \
'*file-prefix=prefix:output file prefix:' \
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
next reply other threads:[~1999-10-21 8:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-10-21 8:32 Sven Wischnowsky [this message]
1999-10-21 9:05 ` Tanaka Akira
-- strict thread matches above, loose matches on Subject: below --
1999-10-21 12:42 Sven Wischnowsky
1999-10-21 10:31 Sven Wischnowsky
1999-10-21 11:28 ` Tanaka Akira
1999-10-18 9:16 Sven Wischnowsky
1999-10-20 16:15 ` Tanaka Akira
1999-10-16 4:47 Tanaka Akira
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=199910210832.KAA32127@beta.informatik.hu-berlin.de \
--to=wischnow@informatik.hu-berlin.de \
--cc=zsh-workers@sunsite.auc.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).