From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: "fake" style requires at least one real match?
Date: Sun, 6 Nov 2016 15:42:02 -0800 [thread overview]
Message-ID: <161106154202.ZM21049@torch.brasslantern.com> (raw)
In-Reply-To: <161105234242.ZM24960@torch.brasslantern.com>
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
_description ...
compadd ...
return
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.
prev parent reply other threads:[~2016-11-06 23:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-04 0:39 Bart Schaefer
2016-11-04 14:00 ` Oliver Kiddle
2016-11-05 3:48 ` Bart Schaefer
2016-11-05 5:02 ` Bart Schaefer
2016-11-06 6:42 ` Bart Schaefer
2016-11-06 23:42 ` Bart Schaefer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=161106154202.ZM21049@torch.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).