zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: PATCH: Re: Option completion after "nono"
Date: Mon, 9 Oct 2000 14:48:18 +0200 (MET DST)	[thread overview]
Message-ID: <200010091248.OAA20614@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: "Bart Schaefer"'s message of Fri, 6 Oct 2000 16:11:01 +0000


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@informatik.hu-berlin.de


             reply	other threads:[~2000-10-09 12:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-10-09 12:48 Sven Wischnowsky [this message]
2000-10-09 14:59 ` Bart Schaefer
2000-10-10  8:31 Sven Wischnowsky
2000-10-10 13:34 Sven Wischnowsky

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=200010091248.OAA20614@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).