From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27226 invoked from network); 3 Apr 2008 15:30:35 -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.3 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; 3 Apr 2008 15:30:35 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 66071 invoked from network); 3 Apr 2008 15:30:31 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 3 Apr 2008 15:30:31 -0000 Received: (qmail 10694 invoked by alias); 3 Apr 2008 15:30:28 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 24787 Received: (qmail 10671 invoked from network); 3 Apr 2008 15:30:27 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 3 Apr 2008 15:30:27 -0000 Received: from cluster-g.mailcontrol.com (cluster-g.mailcontrol.com [85.115.41.190]) by bifrost.dotsrc.org (Postfix) with ESMTP id C9D3582DC37A for ; Thu, 3 Apr 2008 17:30:20 +0200 (CEST) Received: from cameurexb01.EUROPE.ROOT.PRI ([62.189.241.200]) by rly11g.srv.mailcontrol.com (MailControl) with ESMTP id m33FQj0Y020122 for ; Thu, 3 Apr 2008 16:30:09 +0100 Received: from news01 ([10.103.143.38]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.3959); Thu, 3 Apr 2008 16:29:27 +0100 Date: Thu, 3 Apr 2008 16:29:27 +0100 From: Peter Stephenson To: zsh-workers@sunsite.dk (Zsh hackers list) Subject: Re: PATCH: command line highlighting Message-ID: <20080403162927.0eebc411@news01> In-Reply-To: <553.1207231873@dcle12> References: <8360.1207165155@pws-pc> <10127.1207218614@thecus> <20080403123301.43f1f1f9@news01> <553.1207231873@dcle12> Organization: CSR X-Mailer: Claws Mail 3.3.1 (GTK+ 2.12.5; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 03 Apr 2008 15:29:27.0450 (UTC) FILETIME=[80DF0FA0:01C8959F] X-Scanned-By: MailControl A-08-00-04 (www.mailcontrol.com) on 10.71.0.121 X-Virus-Scanned: ClamAV 0.91.2/6567/Thu Apr 3 14:31:07 2008 on bifrost X-Virus-Status: Clean On Thu, 03 Apr 2008 16:11:13 +0200 Oliver Kiddle wrote: > By the way, the documented feature that accepting a line does not save > region_highlight doesn't appear to work. For me, the variable and the > highlights are persisting. I got confused. region_highlight doesn't get unset when it goes out of scope: this is standard behaviour for ZLE variables and we need the effect to persist for the life of the command line here, too. So it needs to be reset explicitly. Clearly it won't be valid for a new line. (For that reason, history could be a bit of a nightmare to get right.) > > We need to be able to see if a key is read within the time and if it is > > unget it and return (like sit-for in Emacs). Something like > > read -kt 1 && zle -U $REPLY > > should work, but I haven't played around with it yet. > > I had to add a call to "zle -R" so that it doesn't wait till the end of > the widget to display the highlight but otherwise, that seems to work. > An additional key typed in less than a second will remove the > highlighting but that's actually fine. Yes, that was deliberate. Index: Src/Zle/zle_main.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_main.c,v retrieving revision 1.106 diff -u -r1.106 zle_main.c --- Src/Zle/zle_main.c 3 Apr 2008 15:20:30 -0000 1.106 +++ Src/Zle/zle_main.c 3 Apr 2008 15:23:51 -0000 @@ -1225,6 +1225,8 @@ zleline = NULL; forget_edits(); errno = old_errno; + /* highlight no longer valid */ + set_region_highlight(NULL, NULL); return s; } Index: Src/Zle/zle_refresh.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_refresh.c,v retrieving revision 1.54 diff -u -r1.54 zle_refresh.c --- Src/Zle/zle_refresh.c 3 Apr 2008 11:39:12 -0000 1.54 +++ Src/Zle/zle_refresh.c 3 Apr 2008 15:23:51 -0000 @@ -434,6 +434,11 @@ } +/* + * The parameter system requires the pm argument, but this + * may be NULL if called directly. + */ + /**/ void set_region_highlight(UNUSED(Param pm), char **aval) -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070