From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16389 invoked from network); 26 Mar 2002 19:24:19 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 26 Mar 2002 19:24:19 -0000 Received: (qmail 29297 invoked by alias); 26 Mar 2002 19:24:10 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 16909 Received: (qmail 29282 invoked from network); 26 Mar 2002 19:24:09 -0000 X-VirusChecked: Checked Date: Tue, 26 Mar 2002 19:23:40 +0000 From: Oliver Kiddle To: Bart Schaefer Cc: Zsh hackers list Subject: Re: up-line-or-search question Message-ID: <20020326192340.GA12802@logica.com> References: <11220.1014827397@csr.com> <8008.1016751391@csr.com> <20020326143047.GA24414@logica.com> <1020326154850.ZM32155@candle.brasslantern.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1020326154850.ZM32155@candle.brasslantern.com> User-Agent: Mutt/1.3.27i Sender: Oliver Kiddle On Tue, Mar 26, 2002 at 03:48:50PM +0000, Bart Schaefer wrote: > That doesn't look quite right to me. If history-beginning-search-forward > fails, it may get tried *again* by the final "else" clause. And that's > forcing a search with a numeric argument, not a down history? > > Seems like it should be I didn't realise that the numeric argument would propagate so thought the second history-beginning-search-backward was harmless. Your replacement breaks the addition that it goes down a line if at the end of the history. So, I think it should be: down-line-or-beginning-search() { if [[ ${+NUMERIC} -eq 0 && ( $LASTWIDGET = $__searching || $RBUFFER != *$'\n'* ) ]] then __searching=$WIDGET zle .history-beginning-search-forward && return fi __searching='' zle .down-line-or-history } > } I was also hoping to move the cursor to the end of the line after > } searches but I can't see how I can move it back before the next search > } without using the mark. > > Stash the value of CURSOR in another global, __searching_pos or some > such, and re-assign to CURSOR only when [[ -n $__searching ]]. I got confused by the documentation stating that those variables are read-only and forgot about assigning to CURSOR, thanks. Changing the zle h-b-s-? commands to: [[ $LASTWIDGET = $__searching ]] && CURSOR=$__savecursor zle .history-beginning-search-backward __savecursor=$CURSOR zle .end-of-line (and moving the return statement in the down-line function) It works for going up but breaks when changing to going down. Basically, it searches down using the whole line instead of up to where the cursor was. Any ideas? > Sure it can; I missed 4735 somehow. You just append the arguments to > the `zle' command after the name of the widget. In the case of the > specific question in 4735, it's the numeric argument, so you have to > use -n, e.g.: > > zle .vi-fetch-history -n $NUMERIC > > I forget whether the default is to propagate $NUMERIC (i.e. if the above > is redundant and you only need -n to change the value). Ok. Thanks. It isn't possible to include args (numeric or otherwise) with a bindkey though is it? Oliver This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.