From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 503 invoked from network); 6 Sep 2009 21:29:11 -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=BAYES_00 autolearn=ham version=3.2.5 Received: from new-brage.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.254.104) by ns1.primenet.com.au with SMTP; 6 Sep 2009 21:29:11 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 94977 invoked from network); 6 Sep 2009 21:29:07 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 6 Sep 2009 21:29:07 -0000 Received: (qmail 6953 invoked by alias); 6 Sep 2009 21:29:03 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 27248 Received: (qmail 6937 invoked from network); 6 Sep 2009 21:29:02 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 6 Sep 2009 21:29:02 -0000 Received: from outpost1.zedat.fu-berlin.de (outpost1.zedat.fu-berlin.de [130.133.4.66]) by bifrost.dotsrc.org (Postfix) with ESMTP id 9B06B8048AD2 for ; Sun, 6 Sep 2009 23:28:56 +0200 (CEST) Received: from relay1.zedat.fu-berlin.de ([130.133.4.67]) by outpost1.zedat.fu-berlin.de (Exim 4.69) for zsh-workers@sunsite.dk with esmtp (envelope-from ) id <1MkPI8-0002LD-47>; Sun, 06 Sep 2009 23:28:56 +0200 Received: from mail.cis.fu-berlin.de ([160.45.11.138]) by relay1.zedat.fu-berlin.de (Exim 4.69) for zsh-workers@sunsite.dk with esmtp (envelope-from ) id <1MkPI8-0006Zy-2A>; Sun, 06 Sep 2009 23:28:56 +0200 Received: by Mail.CIS.FU-Berlin.DE (Exim 4.69) for zsh-workers@sunsite.dk with local (envelope-from ) id <1MkPI7-04ijDT-WC>; Sun, 06 Sep 2009 23:28:56 +0200 Date: Sun, 6 Sep 2009 23:28:55 +0200 From: Holger Weiss To: Zsh Workers Subject: [PATCH] Fix anchoring for vi-history-search-* widgets Message-ID: <20090906212855.GA71836209@Waran.CIS.FU-Berlin.DE> Mail-Followup-To: Zsh Workers MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-Originating-IP: 160.45.11.138 X-Virus-Scanned: ClamAV 0.94.2/9779/Sun Sep 6 11:41:03 2009 on bifrost X-Virus-Status: Clean According to the zshzle(1) manual, the search string specified via vi-history-search-backward or vi-history-search-forward "may begin with `^' to anchor the search to the beginning of the line." This didn't work, because the code which compares the search string with a given history entry checked whether the latter is a prefix of the former, instead of the other way around. --- Src/Zle/zle_hist.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Src/Zle/zle_hist.c b/Src/Zle/zle_hist.c index c9ffda4..5b57f44 100644 --- a/Src/Zle/zle_hist.c +++ b/Src/Zle/zle_hist.c @@ -1942,7 +1942,7 @@ virepeatsearch(UNUSED(char **args)) continue; zt = GETZLETEXT(he); if (zlinecmp(zt, zlemetaline) && - (*visrchstr == '^' ? strpfx(zt, visrchstr + 1) : + (*visrchstr == '^' ? strpfx(visrchstr + 1, zt) : zlinefind(zt, 0, visrchstr, 1, 1) != 0)) { if (--n <= 0) { unmetafy_line(); -- Holger