Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: Re: Option completion after "nono"
- X-seq: zsh-workers 12930
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: PATCH: Re: Option completion after "nono"
- Date: Mon, 9 Oct 2000 14:48:18 +0200 (MET DST)
- In-reply-to: "Bart Schaefer"'s message of Fri, 6 Oct 2000 16:11:01 +0000
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
Bart Schaefer wrote:
> On Oct 6, 2:53pm, Sven Wischnowsky wrote:
> }
> } We use nonomatch not because of globbing, but because of ~... and
> } =... expansion.
>
> Speaking of using nonomatch, have you tried to complete it?
>
> zagzig% setopt nonom<TAB>
> nonomagicequalsubst nonomarkdirs nonomultios
> nonomailwarn nonomenucomplete
> nonomailwarning nonomonitor
>
> Hmm, where is it?
>
> ...
>
> There has to be some kind of matcher-magic to insert into _options (and
> into the example in the "Matching Control" doc) that means to accept
> matches both with _and without_ the leading "no" deleted, but I can't
> work out what it is.
Hm, I think it should do the right thing without using match-spec
hacks.
The patch below does that by preferring exact character matches over
using match specs. I know I once had a reason for doing it
differently, but I can't remember which. The completion matching tests
work and the only ones that might be in danger are ones with partial
word matching (as far as I can see). And the recusive code for that
has been improved several times since I made it prefer match specs
over exact character matches.
So I've left a comment in there and we'll see if it breaks anything.
If it doesn't, fine, that would make matching quite a bit faster...
Bye
Sven
Index: Src/Zle/compmatch.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/compmatch.c,v
retrieving revision 1.23
diff -u -r1.23 compmatch.c
--- Src/Zle/compmatch.c 2000/07/19 14:04:57 1.23
+++ Src/Zle/compmatch.c 2000/10/09 12:47:39
@@ -485,10 +485,19 @@
* recursive calls. At least, it /seems/ to work.
*
* Let's try.
+ *
+ * Update: this once tested `test && ...' to check for exact
+ * character matches only in recursive calls. But then one
+ * can't complete `nom<TAB>' to `nomatch' with a match spec
+ * of `B:[nN][oO]=' because that will eat the `no'. I'm almost
+ * certain that this will break something, but I don't know what
+ * or if it really is a problem (or has been fixed by other
+ * changes in the code handling partial word matching). And the
+ * completion matching tests work.
*/
bslash = 0;
- if (test && !sfx && lw &&
+ if (!sfx && lw &&
(l[ind] == w[ind] ||
(bslash = (lw > 1 && w[ind] == '\\' &&
(ind ? (w[0] == l[0]) : (w[1] == l[0])))))) {
--
Sven Wischnowsky wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author