From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3540 invoked from network); 28 Jul 2006 10:12:12 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO,SUBJ_HAS_UNIQ_ID autolearn=ham version=3.1.3 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 28 Jul 2006 10:12:12 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 58834 invoked from network); 28 Jul 2006 10:12:03 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 28 Jul 2006 10:12:03 -0000 Received: (qmail 17655 invoked by alias); 28 Jul 2006 10:12:00 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 22560 Received: (qmail 17610 invoked from network); 28 Jul 2006 10:12:00 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 28 Jul 2006 10:12:00 -0000 Received: (qmail 57491 invoked from network); 28 Jul 2006 10:11:56 -0000 Received: from cluster-c.mailcontrol.com (168.143.177.190) by a.mx.sunsite.dk with SMTP; 28 Jul 2006 10:11:53 -0000 Received: from cameurexb01.EUROPE.ROOT.PRI ([62.189.241.200]) by rly07c.srv.mailcontrol.com (MailControl) with ESMTP id k6SA0oL3003923 for ; Fri, 28 Jul 2006 11:11:39 +0100 Received: from news01.csr.com ([10.103.143.38]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.1830); Fri, 28 Jul 2006 11:08:31 +0100 Received: from news01.csr.com (localhost.localdomain [127.0.0.1]) by news01.csr.com (8.13.4/8.13.4) with ESMTP id k6SA8Vuv019638 for ; Fri, 28 Jul 2006 11:08:31 +0100 Received: from csr.com (pws@localhost) by news01.csr.com (8.13.4/8.13.4/Submit) with ESMTP id k6SA8VJQ019635 for ; Fri, 28 Jul 2006 11:08:31 +0100 Message-Id: <200607281008.k6SA8VJQ019635@news01.csr.com> X-Authentication-Warning: news01.csr.com: pws owned process doing -bs To: zsh-workers@sunsite.dk (Zsh hackers list) Subject: Re: Menu-driven version of history-beginning-search-backward In-reply-to: <200607280910.k6S9AmW2018630@news01.csr.com> References: <200607261638.k6QGcE7E010498@news01.csr.com> <060727212432.ZM4920@torch.brasslantern.com> <200607280910.k6S9AmW2018630@news01.csr.com> Comments: In-reply-to Peter Stephenson message dated "Fri, 28 Jul 2006 10:10:48 +0100." Date: Fri, 28 Jul 2006 11:08:31 +0100 From: Peter Stephenson X-OriginalArrivalTime: 28 Jul 2006 10:08:31.0968 (UTC) FILETIME=[C7A96E00:01C6B22D] Content-Type: text/plain MIME-Version: 1.0 X-Scanned-By: MailControl A-07-00-11 (www.mailcontrol.com) on 10.67.0.117 Minor tweak with just interesting enough consequences to bother posting about. The menu displayed with "zle -R" doesn't get cleared; I think that's because the code doesn't remember the list of things it's displaying as it does in the completion code. I've hacked it here to clear the list by brute force. This is related to another annoyance that the completion listing code is tied to completion and then hooked into zle_refresh.c. If it were a properly separate module (it's already a different library, but the API is a bit non-existent) we could use it for tasks like menu selection in a case like this, outside the completion code. This is a pipe dream. Index: Functions/Zle/history-beginning-search-menu =================================================================== RCS file: /cvsroot/zsh/zsh/Functions/Zle/history-beginning-search-menu,v retrieving revision 1.1 diff -u -r1.1 history-beginning-search-menu --- Functions/Zle/history-beginning-search-menu 28 Jul 2006 09:52:35 -0000 1.1 +++ Functions/Zle/history-beginning-search-menu 28 Jul 2006 10:01:53 -0000 @@ -41,6 +41,10 @@ local search=$LBUFFER if [[ $WIDGET = *-space* ]]; then + # We need to quote metacharacters in the search string + # since they are otherwise active in the reverse subscript. + # We need to avoid quoting other characters since they aren't + # and just stay quoted, rather annoyingly. search=${search//(#m)[*?#<>]/\\$MATCH/} search=${search// /*} fi @@ -68,7 +72,14 @@ local chars read -k$width chars +# Hmmm... this isn't great. The only way of clearing the display +# appears to be to overwrite it completely. I think that's because +# displaying strings in this way doesn't set the completion list +# properly. +display=(${display//?/ }) + if [[ $chars != [[:digit:]]## || $chars -eq 0 || $chars -gt $n ]]; then + zle -R '' $display return 1 fi @@ -87,3 +98,5 @@ BUFFER=${matches[$chars]} (( newcursor )) && CURSOR=$newcursor fi + +zle -R '' $display -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070 To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php