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

Re: completion oddity

>>>>> On May 21, 2012 Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:

> With --r-word on the line, there is only one possible completion that
> has exactly one embedded hyphen.  This is considered a unique match, so
> when you press TAB, it fills in that word and is done.

Then it seems like the previous press of TAB should not have completed
to '--r-word'.  Is it not also the case that completion is designed to
list the choices when there is ambiguity, at least when the autolist
and listambiguous options are set?

In this example, completing from 'k --' twice completely loses the
ambiguity, and completes to '--r1-word' as though that were the only
option starting with '--'.

The thing that seems even more broken is if I compare completion in
the two cases below..


zsh -f 
% autoload -Uz compinit
% compinit -i
% _k () { _arguments --r1-word --really-r1-word }
% compdef _k k
% setopt autolist listambiguous completeinword noautomenu

now compare this:

% k --
# hit <tab> at end of line
% k --r-word
# cursor now on the final hyphen; hit <tab> again
% k --r1-word 
# cursor now after appended space


% k --r-word
# with cursor on final hyphen hit <tab>:
# nothing inserted; the *two* options are listed
# no matter how many times you hit <tab>

So there must be some hidden state from the initial completion in the
first case, because otherwise I would expect hitting <tab> on the same
command line with the cursor in the same position to give the same


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