zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@sunsite.dk
Subject: Re: completion: highlight matching part
Date: Mon, 04 Aug 2008 17:16:11 -0700	[thread overview]
Message-ID: <080804171611.ZM11739@torch.brasslantern.com> (raw)
In-Reply-To: <080804165426.ZM862@torch.brasslantern.com>

On Aug 4,  4:54pm, Bart Schaefer wrote:
} Subject: Re: completion: highlight matching part
}
} On Aug 4,  8:44pm, Peter Stephenson wrote:
} } Subject: Re: completion: highlight matching part
} }
} } On Sun, 03 Aug 2008 17:33:21 -0700
} } Bart Schaefer <schaefer@brasslantern.com> wrote:
} } > (1) Change complist.c:putfilecol() so that pattern tests come first,
} } >     then mode tests, and finally extension tests.
} } 
} } I should think this is the right thing to do, isn't it?
} 
} I agree

Here's the patch, mostly so you can proof my doc change.

Index: Doc/Zsh/mod_complist.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/mod_complist.yo,v
retrieving revision 1.24
diff -u -r1.24 mod_complist.yo
--- Doc/Zsh/mod_complist.yo	5 Jul 2008 19:55:29 -0000	1.24
+++ Doc/Zsh/mod_complist.yo	5 Aug 2008 00:15:00 -0000
@@ -103,9 +103,9 @@
 pattern; the tt(EXTENDED_GLOB) option will be turned on for evaluation
 of the pattern.  The var(value) given for this pattern will be used for all
 matches (not just filenames) whose display string are matched by
-the pattern.  Definitions for both of these take precedence over the
-values defined for file types and the form with the leading asterisk 
-takes precedence over the form with the leading equal sign.
+the pattern.  Definitions for the form with the leading equal sign take
+precedence over the values defined for file types, which in turn take
+precedence over the form with the leading asterisk (file extensions).
 
 The last form also allows different parts of the displayed
 strings to be colored differently.  For this, the pattern has to use the
Index: Src/Zle/complist.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/complist.c,v
retrieving revision 1.117
diff -u -r1.117 complist.c
--- Src/Zle/complist.c	5 Jul 2008 19:55:29 -0000	1.117
+++ Src/Zle/complist.c	5 Aug 2008 00:15:00 -0000
@@ -878,6 +878,21 @@
     Extcol ec;
     Patcol pc;
 
+    nrefs = MAX_POS - 1;
+
+    for (pc = mcolors.pats; pc; pc = pc->next)
+	if ((!pc->prog || !group || pattry(pc->prog, group)) &&
+	    pattryrefs(pc->pat, n, -1, -1, 0, &nrefs, begpos, endpos)) {
+	    if (pc->cols[1]) {
+		patcols = pc->cols;
+
+		return 1;
+	    }
+	    zlrputs(pc->cols[0]);
+
+	    return 0;
+	}
+
     if (special != -1) {
 	colour = special;
     } else if (S_ISDIR(m)) {
@@ -920,21 +935,6 @@
 	    return 0;
 	}
 
-    nrefs = MAX_POS - 1;
-
-    for (pc = mcolors.pats; pc; pc = pc->next)
-	if ((!pc->prog || !group || pattry(pc->prog, group)) &&
-	    pattryrefs(pc->pat, n, -1, -1, 0, &nrefs, begpos, endpos)) {
-	    if (pc->cols[1]) {
-		patcols = pc->cols;
-
-		return 1;
-	    }
-	    zlrputs(pc->cols[0]);
-
-	    return 0;
-	}
-
     zcputs(group, COL_FI);
 
     return 0;


  reply	other threads:[~2008-08-05  0:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20080801163301.GA3589@pepin.polanet.pl>
     [not found] ` <080802143558.ZM815@torch.brasslantern.com>
     [not found]   ` <20080803111423.GA11247@pepin.polanet.pl>
     [not found]     ` <080803103117.ZM26039@torch.brasslantern.com>
2008-08-04  0:33       ` Bart Schaefer
2008-08-04 19:44         ` Peter Stephenson
2008-08-04 23:54           ` Bart Schaefer
2008-08-05  0:16             ` Bart Schaefer [this message]
2008-08-05  8:13               ` Peter Stephenson
2008-08-05 10:30                 ` Rocky Bernstein
2008-08-05 10:49                   ` Peter Stephenson

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=080804171611.ZM11739@torch.brasslantern.com \
    --to=schaefer@brasslantern.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).