zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: "Zsh Hackers' List" <zsh-workers@sunsite.dk>
Subject: Re: help with matcher-list style
Date: Thu, 29 Jan 2009 11:03:53 +0000	[thread overview]
Message-ID: <20090129110353.65527d81@news01> (raw)
In-Reply-To: <090129005248.ZM10205@torch.brasslantern.com>

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


       reply	other threads:[~2009-01-29 11:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <18817.6080.228775.132881@gargle.gargle.HOWL>
     [not found] ` <090129005248.ZM10205@torch.brasslantern.com>
2009-01-29 11:03   ` Peter Stephenson [this message]
2009-01-29 15:23     ` Bart Schaefer

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=20090129110353.65527d81@news01 \
    --to=pws@csr.com \
    --cc=zsh-workers@sunsite.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).