Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: ZLE Widget: Insert last word (except &)



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.



Messages sorted by: Reverse Date, Date, Thread, Author