From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25695 invoked from network); 26 Apr 2008 20:23:47 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.4 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 26 Apr 2008 20:23:47 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 670 invoked from network); 26 Apr 2008 20:23:41 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 26 Apr 2008 20:23:41 -0000 Received: (qmail 25964 invoked by alias); 26 Apr 2008 20:23:38 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 24879 Received: (qmail 25947 invoked from network); 26 Apr 2008 20:23:38 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 26 Apr 2008 20:23:38 -0000 Received: from mtaout03-winn.ispmail.ntl.com (mtaout03-winn.ispmail.ntl.com [81.103.221.49]) by bifrost.dotsrc.org (Postfix) with ESMTP id C289C808A38B for ; Sat, 26 Apr 2008 22:23:34 +0200 (CEST) Received: from aamtaout01-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout03-winn.ispmail.ntl.com with ESMTP id <20080426202747.KSGV19548.mtaout03-winn.ispmail.ntl.com@aamtaout01-winn.ispmail.ntl.com> for ; Sat, 26 Apr 2008 21:27:47 +0100 Received: from pws-pc.ntlworld.com ([81.107.40.67]) by aamtaout01-winn.ispmail.ntl.com with ESMTP id <20080426202756.IGOO219.aamtaout01-winn.ispmail.ntl.com@pws-pc.ntlworld.com> for ; Sat, 26 Apr 2008 21:27:56 +0100 Received: from pws-pc (pws-pc [127.0.0.1]) by pws-pc.ntlworld.com (8.14.2/8.14.2) with ESMTP id m3QKMthr028055 for ; Sat, 26 Apr 2008 21:22:55 +0100 Message-Id: <200804262022.m3QKMthr028055@pws-pc.ntlworld.com> From: Peter Stephenson To: zsh-workers@sunsite.dk (Zsh hackers list) Subject: Re: PATCH: pattern incremental search In-Reply-To: Message from Peter Stephenson of "Sat, 26 Apr 2008 20:41:47 BST." <26439.1209238907@pws-pc> Date: Sat, 26 Apr 2008 21:22:55 +0100 X-Virus-Scanned: ClamAV 0.91.2/6957/Sat Apr 26 20:28:22 2008 on bifrost X-Virus-Status: Clean Peter Stephenson wrote: > I think this is now good enough for some beta testing, though I'm sure > there must be glitches. Just discovered this. I hope this is the right fix. Index: Src/Zle/zle_hist.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_hist.c,v retrieving revision 1.44 diff -u -r1.44 zle_hist.c --- Src/Zle/zle_hist.c 26 Apr 2008 19:51:09 -0000 1.44 +++ Src/Zle/zle_hist.c 26 Apr 2008 20:21:50 -0000 @@ -1074,6 +1074,14 @@ */ int revert_patpos = 0; /* + * Another nasty feature related to the above. When + * we revert the position, we might advance the search to + * the same line again. When we do this the test for ignoring + * duplicates may trigger. This flag indicates that in this + * case it's OK. + */ + int dup_ok = 0; + /* * savekeys records the unget buffer, so that if we have arguments * they don't pollute the input. * feep indicates we should feep. This is a well-known word @@ -1219,6 +1227,7 @@ * search started; see note above. */ revert_patpos = 0; + dup_ok = 1; he = quietgethist(hl = pat_hl); zt = GETZLETEXT(he); pos = pat_pos; @@ -1322,10 +1331,14 @@ hl = he->histnum; zt = GETZLETEXT(he); pos = (dir == 1) ? 0 : strlen(zt); - skip_line = isset(HISTFINDNODUPS) - ? !!(he->node.flags & HIST_DUP) - : !strcmp(zt, last_line); + if (dup_ok) + skip_line = 0; + else + skip_line = isset(HISTFINDNODUPS) + ? !!(he->node.flags & HIST_DUP) + : !strcmp(zt, last_line); } + dup_ok = 0; /* * If we matched above (t set), set the new line. * If we didn't, but are here because we are on a previous -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/