Zsh Mailing List Archive
Messages sorted by:
Re: "fake" style requires at least one real match?
On Nov 5, 11:42pm, Bart Schaefer wrote:
} I have no immediate idea what to do about this. We can't rewrite
} every caller of _description to delta $compstate[nmatches] just
} in case a fake style was used. And in fact it only matters when
} ONLY the fake matches are added, as the Subject: says ...
I looked through all the functions that call _description and for
the vast majority of them this only matters indirectly to the caller
of the function; that is, the usage is equivalent to
which means that unless the caller is testing the return value to
decide whether to proceed with another completion, adding fake matches
in _description does not affect anything. Ignoring for the moment
functions that might appear directly in the 'completer' style, that
leaves the following callers of _description:
_requested and _next_label both ignore the result of _description and
always return zero after calling it.
_alternative does the "right thing" and uses a delta of nmatches to
decide what to return.
_values uses _all_labels and a _next_label loop.
_next_tags redefines _all_labels and _next_label, so I'm going to
ignore it for this purpose.
And then there's _arguments, which has a _tags loop but is a wrapper
that calls back to whatever was passed into it; so there's really no
reasonable way to analyze it.
I think, therefore, the only reasonable thing is to fix _all_labels,
which should by proxy fix _values. However, it's a little more
complicated than I first thought.
A compounding problem is that we're calling _tilde from _alternative.
_alternative does its own call to _description on line 28, inside
the _tags loop. Inside _tilde, we start another _tags loop, which
eventually calls _all_labels, which calls _description *again*. The
fake matches were already added by the first call in _alternative,
so compstate[nmatches] is unchanged and can't work as a test for the
appropriate return value for _all_labels.
For the moment I'm stuck. Sorry for the play-by-play. Ideas welcome.
Probably not worth holding up a release, if one is being considered.
Messages sorted by: