Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: completion oddity
On Tue, May 22, 2012 at 9:18 AM, Greg Klanderman <gak@xxxxxxxxxxxxxx> wrote:
>
>>>>>> 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'.
Sven W. was a clever but highly suggestible university student.
Someone said, "Hey, all these possible variations end with the same
substring, why isn't completion smart enough to fill that in for me?"
and Sven responded, "OK, now it is that smart," and all the possible
side-effects were either not considered or considered to be less
important than the smarts.
> % 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
> results.
You're right; in the first case the completion system has recorded a
list of "ambiguous positions" that distinguish what it filled in vs.
what the user typed. It decides whether the match is unique based on
whether there is another ambiguous position to which it can advance.
This is all part of the aforementioned smarts.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author