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

Re: PATCH: zle parameters in completion widgets



Bart Schaefer wrote:

> On Jan 29, 11:08am, Sven Wischnowsky wrote:
> } Subject: PATCH: zle parameters in completion widgets
> }
> } Now, to get completion only on the second tab, just add
> } 
> }   [[ "$WIDGET" != "$LASTWIDGET" ]] && return
> 
> Actually, the request as for completion on the first tab, but autolist
> only on the second tab.

[That would be only `setopt LIST_AMBIGUOUS'.]

After playing with bash a bit, it seems that to fully copy the
behaviour one would have to setopt LIST_AMBIGUOUS and use something
like:

  lastbuffer=''  # non-local variable definition

  ...

  completion-widget() {
    ...
    [[ "$BUFFER" = "$lastbuffer" && "$WIDGET" != "$LASTWIDGET" ]] && return
    ...
  }

At least I get completion of the unambiguous stuff on the first tab,
nothing on the second and the list on the third.


> So it'd have to be something like
> 
>     [[ "$WIDGET" != "$LASTWIDGET" ]] && complist ...
> 
> where "..." gets filled in appropriately for whatever other completion
> is in progress.  Right?

See above. Also: to allow the completion widget to say if only
something should be inserted or if also the list should be shown, we
would need a way to control this kind of stuff from the widget. This
is on my wish list (it also appears somewhere in my longish
description mail), but not yet implemented.

Bye
 Sven


--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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