zsh-workers
 help / color / mirror / code / Atom feed
* Re: help with matcher-list style
       [not found] ` <090129005248.ZM10205@torch.brasslantern.com>
@ 2009-01-29 11:03   ` Peter Stephenson
  2009-01-29 15:23     ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Stephenson @ 2009-01-29 11:03 UTC (permalink / raw)
  To: Zsh Hackers' List

On Thu, 29 Jan 2009 00:52:48 -0800
Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Jan 28,  9:43pm, Greg Klanderman wrote:
> }
> } I'm currently using this matcher-list setting:
> } 
> } zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' '+ l:|=* r:|=*'
> 
> Interesting.  When I attempt to use that with the latest CVS (1.4529)
> I get errors:
> 
> 39: ../../../zsh-4.0/Src/Zle/compmatch.c:1181: bad matcher pattern type
> 39: ../../../zsh-4.0/Src/Zle/compmatch.c:1181: bad matcher pattern type
> (repeats a dozen times or so)
> 
> I do NOT get that error with 4.2.0 (the only older zsh I have handy
> at the moment).  It's got something to do with m:{a-zA-Z}={A-Za-z}
> appearing all by itself in that second element; if it appears along
> with an r: pattern (for example), there is no error, and if I leave
> it out, there is no error.

(Move to zsh-workers.)

I think this is it, but this is near the very heart of the fog, and a
second pair of eyes here would be very useful.  "tmpgenpat" and "wp" now
have comparable relationships to "curgenpat" and "wordcp", respectively, so
the code certainly looks better.

Index: Src/Zle/compmatch.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/compmatch.c,v
retrieving revision 1.63
diff -u -r1.63 compmatch.c
--- Src/Zle/compmatch.c	18 Nov 2008 10:07:31 -0000	1.63
+++ Src/Zle/compmatch.c	29 Jan 2009 10:59:41 -0000
@@ -1818,10 +1818,12 @@
 
 	if (sfx) {
 	    wp = wordcp - 1;
-	    curgenpat--;
-	} else
+	    tmpgenpat = curgenpat - 1;
+	} else {
+	    tmpgenpat = curgenpat;
 	    wp = wordcp;
-	if (pattern_match1(curgenpat, *wp, &wmtp))
+	}
+	if (pattern_match1(tmpgenpat, *wp, &wmtp))
 	{
 	    convchar_t lchr;
 	    /*
@@ -1831,8 +1833,8 @@
 	     * else if it's generic, keep the word character,
 	     * since we have no choice.
 	     */
-	    if (curgenpat->tp == CPAT_CHAR)
-		lchr = curgenpat->u.chr;
+	    if (tmpgenpat->tp == CPAT_CHAR)
+		lchr = tmpgenpat->u.chr;
 	    else
 		lchr = *wp;
 
@@ -1845,9 +1847,10 @@
 	    wlen--;
 	    rl++;
 
-	    if (sfx)
+	    if (sfx) {
 		wordcp = wp;
-	    else {
+		curgenpat = tmpgenpat;
+	    } else {
 		if (llen)
 		    curgenpat++;
 		wordcp++;


-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: help with matcher-list style
  2009-01-29 11:03   ` help with matcher-list style Peter Stephenson
@ 2009-01-29 15:23     ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2009-01-29 15:23 UTC (permalink / raw)
  To: Zsh Hackers' List

On Jan 29, 11:03am, Peter Stephenson wrote:
} Subject: Re: help with matcher-list style
}
} On Thu, 29 Jan 2009 00:52:48 -0800
} Bart Schaefer <schaefer@brasslantern.com> wrote:
} > 39: ../../../zsh-4.0/Src/Zle/compmatch.c:1181: bad matcher pattern type
} > 39: ../../../zsh-4.0/Src/Zle/compmatch.c:1181: bad matcher pattern type
} > (repeats a dozen times or so)
} 
} I think this is it, but this is near the very heart of the fog, and a
} second pair of eyes here would be very useful.  "tmpgenpat" and "wp" now
} have comparable relationships to "curgenpat" and "wordcp", respectively, so
} the code certainly looks better.

It looks right to me on inspection, but I'm flying almost entirely by
instinct in that part of the code.

Anyone want to figure out how to add a regression test for this to
Test/Y02compmatch.ztst ?


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-01-29 15:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <18817.6080.228775.132881@gargle.gargle.HOWL>
     [not found] ` <090129005248.ZM10205@torch.brasslantern.com>
2009-01-29 11:03   ` help with matcher-list style Peter Stephenson
2009-01-29 15:23     ` Bart Schaefer

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).