From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1286 invoked from network); 21 Mar 2002 22:57:31 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 21 Mar 2002 22:57:31 -0000 Received: (qmail 28699 invoked by alias); 21 Mar 2002 22:57:18 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 16879 Received: (qmail 28660 invoked from network); 21 Mar 2002 22:57:16 -0000 To: zsh-workers@sunsite.dk (Zsh hackers list) Subject: Re: up-line-or-search question In-reply-to: "Peter Stephenson"'s message of "Wed, 27 Feb 2002 16:29:57 GMT." <11220.1014827397@csr.com> Date: Thu, 21 Mar 2002 22:56:31 +0000 Message-ID: <8008.1016751391@csr.com> From: Peter Stephenson Peter Stephenson wrote: > "Bart Schaefer" wrote: > > Search the zsh-users archive for the string: up-line-or-beginning > > Are these the currently agreed definitions? If so, they can be added to > Functions/Zle and the zshcontrib manual page. I'm going to commit the following. It's up to Oliver whether he wants to do something more sophisticated. Index: Doc/Zsh/contrib.yo =================================================================== RCS file: /cvsroot/zsh/zsh/Doc/Zsh/contrib.yo,v retrieving revision 1.18 diff -u -r1.18 contrib.yo --- Doc/Zsh/contrib.yo 5 Mar 2002 16:33:21 -0000 1.18 +++ Doc/Zsh/contrib.yo 21 Mar 2002 22:55:06 -0000 @@ -430,6 +430,17 @@ bindkey '\e^P' history-beginning-search-backward-end bindkey '\e^N' history-beginning-search-forward-end) ) +tindex(up-line-or-beginning-search) +tindex(down-line-or-beginning-search) +item(tt(up-line-or-beginning-search), tt(down-line-or-beginning-search))( +These widgets are similar to the builtin functions tt(up-line-or-search) +and tt(down-line-or-search): if in a multiline buffer they move up or +down within the buffer, otherwise they search for a history line matching +the start of the current line. In this case, however, they search for +a line which matches the current line up to the current cursor position, in +the manner of tt(history-begining-search-backward) and tt(-forward), rather +than the first word on the line. +) tindex(incarg) vindex(incarg, use of) item(tt(incarg))( Index: Functions/Zle/down-line-or-beginning-search =================================================================== RCS file: Functions/Zle/down-line-or-beginning-search diff -N Functions/Zle/down-line-or-beginning-search --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ Functions/Zle/down-line-or-beginning-search 21 Mar 2002 22:55:06 -0000 @@ -0,0 +1,13 @@ +# Like down-line-or-search, but uses the whole line prefix up to the +# cursor position for searching forwards. + +if [[ $LASTWIDGET != $WIDGET ]] +then + if [[ $LBUFFER == *$'\n'* ]] + then + __last_down_line=down-line-or-history + else + __last_down_line=history-beginning-search-forward + fi +fi +zle .${__last_down_line:-beep} Index: Functions/Zle/up-line-or-beginning-search =================================================================== RCS file: Functions/Zle/up-line-or-beginning-search diff -N Functions/Zle/up-line-or-beginning-search --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ Functions/Zle/up-line-or-beginning-search 21 Mar 2002 22:55:06 -0000 @@ -0,0 +1,13 @@ +# Like up-line-or-search, but uses the whole line prefix up to the +# cursor position for searching backwards. + +if [[ $LASTWIDGET != $WIDGET ]] +then + if [[ $LBUFFER == *$'\n'* ]] + then + __last_up_line=up-line-or-history + else + __last_up_line=history-beginning-search-backward + fi +fi +zle .${__last_up_line:-beep} -- Peter Stephenson Software Engineer CSR Ltd., Science Park, Milton Road, Cambridge, CB4 0WH, UK Tel: +44 (0)1223 392070 ********************************************************************** The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. **********************************************************************