From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18225 invoked from network); 12 Jul 2000 22:33:47 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 12 Jul 2000 22:33:47 -0000 Received: (qmail 17665 invoked by alias); 12 Jul 2000 22:33:12 -0000 Mailing-List: contact zsh-users-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 3275 Received: (qmail 17658 invoked from network); 12 Jul 2000 22:33:11 -0000 Date: Wed, 12 Jul 2000 15:33:05 -0700 (PDT) From: Bart Schaefer Sender: schaefer@aztec.zanshin.com Reply-To: Bart Schaefer To: Christoph Lange cc: zsh-users@sunsite.auc.dk Subject: Re: ZLE Widget: Insert last word (except &) In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Wed, 12 Jul 2000, Christoph Lange wrote: > I didn't understand all of it, but now the functions even fails doing > elementar things: > > % echo a & > a > % echo > ^ [Alt+.] pressed Oops; I tried to edit a cut'n'paste screwup in place, and accidentally re-inserted a line from the old version. Change ((--i)) to ((++i)) in the `else' inside the `while' loop. Sorry about that. > I found out another interesting thing about my first version. zsh goes up in > the history on subsequent calls of insert-last-word, but from the widget's > point of view, the position in the history remains the same. Either > determining the previous line with `fc -n -l -1' or -- like in your widget > -- going up the history and reading from $BUFFER always returns the previous > line relative from the position where the user started calling > insert-last-word. That's why I had to the goofy bit with ((NUMERIC=_ilw_count+1)) in my revised version. That makes up-history go up the correct number of lines, and down-history go back down the correct number.