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

Re: A weird bug of grep completion



Is there anyone looking into this problem?

A minimal example to reproduce the problem is:
    % _cmd() { compadd -M 'r:|[_-]=*' a-b a-c-d }       # [1]
    % compdef _cmd cmd
    % cmd <TAB>
The cursor is misplaced after the first TAB.

If a-c-d is replaced by a-c-b, the problem becomes worse:
    % _cmd() { compadd -M 'r:|[_-]=*' a-b a-c-b }       # [2]
    % cmd <TAB>
Only a-b is completed in this case.
The following behaves similarly (only a-b is completed):
    % _cmd() { compadd -M 'r:|[_-]=*' a-b a-c-b a-d-b } # [3]

But the followings are OK:
    % _cmd() { compadd -M 'r:|[_-]=*' a-c-b a-b }       # [4]
or
    % _cmd() { compadd -M 'r:|[_-]=*' a-b a-e a-c-b }   # [5]

[2] and [4] differ only in the order 'a-b' and 'a-c-b' are passed
to compadd. I guess the function join_clines() (compmatch.c) is
most suspicious but not sure.
Anyway the code is too complicated for me to debug.



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