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

Re: feature-request of double-tab-list



I wrote:

> Bart Schaefer wrote:
> 
> > Way way back on Sep 19,  5:36pm, Rasmus Tengblad wrote:
> > } Subject: feature-request of double-tab-list
> > }
> > } First i'd like to tell you that I really like zsh. Best shell there is!
> > } However, there is one small thing I like better about bash, and that's the
> > } double-tab-press or what ever you'd want to call it. It's sort of like zsh
> > } with AUTO_LIST set, but with the exception that you have to press tab
> > } twice before the list is displayed.
> > 
> > OK, Sven, can we implement this using the new completion stuff?  What, if
> > any, hooks are there for keeping track of the first vs. the second press
> > of the completion key within the same completion?
> 
> We could give free the zle-parameters (LBUFFER,...) in completion
> widgets and then do something like:
> 
>   local lastl lastr
> 
>   if [[ "$LBUFFER" != "$lastl" || "$RBUFFER" != "$lastr" ]] then
>     lastl="$LBUFFER"
>     lastr="$RBUFFER"
>     return
>   fi
> 
> We should make them readonly in completion widgets, though (since the
> match-inserting code could get terribly confused otherwise).
> 
> Would that be enough?

No, for a correct solution this wouldn't be enough. For that we would
need information about the last zle widget executed (the one *before*
the one that is currently executing). This should be possible by
adding another zle parameter (sister of BUFFER, CURSOR,...).
Then, when we make those parameters readable in completion widgets, we 
can test if the last widget was the same as the current one.

Bye
 Sven


--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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