From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29642 invoked from network); 5 Aug 2008 00:17:00 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 5 Aug 2008 00:17:00 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 80813 invoked from network); 5 Aug 2008 00:16:49 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 5 Aug 2008 00:16:49 -0000 Received: (qmail 22213 invoked by alias); 5 Aug 2008 00:16:38 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25389 Received: (qmail 22190 invoked from network); 5 Aug 2008 00:16:34 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 5 Aug 2008 00:16:34 -0000 Received: from vms173005pub.verizon.net (vms173005pub.verizon.net [206.46.173.5]) by bifrost.dotsrc.org (Postfix) with ESMTP id 176C080590E6 for ; Tue, 5 Aug 2008 02:16:18 +0200 (CEST) Received: from torch.brasslantern.com ([96.238.214.225]) by vms173005.mailsrvcs.net (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPA id <0K530069DQ306L72@vms173005.mailsrvcs.net> for zsh-workers@sunsite.dk; Mon, 04 Aug 2008 19:16:13 -0500 (CDT) Received: from torch.brasslantern.com (localhost.localdomain [127.0.0.1]) by torch.brasslantern.com (8.13.1/8.13.1) with ESMTP id m750GB8c011741 for ; Mon, 04 Aug 2008 17:16:12 -0700 Received: (from schaefer@localhost) by torch.brasslantern.com (8.13.1/8.13.1/Submit) id m750GBJR011740 for zsh-workers@sunsite.dk; Mon, 04 Aug 2008 17:16:11 -0700 Date: Mon, 04 Aug 2008 17:16:11 -0700 From: Bart Schaefer Subject: Re: completion: highlight matching part In-reply-to: <080804165426.ZM862@torch.brasslantern.com> To: zsh-workers@sunsite.dk Message-id: <080804171611.ZM11739@torch.brasslantern.com> MIME-version: 1.0 X-Mailer: OpenZMail Classic (0.9.2 24April2005) Content-type: text/plain; charset=us-ascii References: <20080801163301.GA3589@pepin.polanet.pl> <080802143558.ZM815@torch.brasslantern.com> <20080803111423.GA11247@pepin.polanet.pl> <080803103117.ZM26039@torch.brasslantern.com> <080803173321.ZM31527@torch.brasslantern.com> <20080804204422.13f922db@pws-pc> <080804165426.ZM862@torch.brasslantern.com> Comments: In reply to Bart Schaefer "Re: completion: highlight matching part" (Aug 4, 4:54pm) X-Virus-Scanned: ClamAV 0.92.1/7941/Tue Aug 5 00:44:27 2008 on bifrost X-Virus-Status: Clean 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 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;