Zsh Mailing List Archive
Messages sorted by:
Re: [BUG] _describe -x adds same completion group header twice
- X-seq: 49450
- From: Oliver Kiddle <opk@xxxxxxx>
- To: Marlon Richert <marlon.richert@xxxxxxxxx>
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: [BUG] _describe -x adds same completion group header twice
- Date: Sun, 26 Sep 2021 22:21:05 +0200
- Archived-at: <https://zsh.org/workers/49450>
- In-reply-to: <CAHLkEDt_u77Yx6WRtwhrh19uGyKoL=a=P_j3L=PFPzkb_shC4A@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAHLkEDvyi5OvnH0Mo7pFDrJNUPevLsC7btVr3jnq_=B7WjNKxw@mail.gmail.com> <CAH+w=7YHoyioVFe9Kpw3bfP667z5N7WpW4uLCe0NoSFnvRbzEw@mail.gmail.com> <CAHLkEDt_u77Yx6WRtwhrh19uGyKoL=a=P_j3L=PFPzkb_shC4A@mail.gmail.com>
On 10 Sep, Marlon Richert wrote:
> The problem here looks to me that compadd -x *always* adds a header,
> even when used with -D, whereas compadd -X does *not* add a header
> Which of these two should we consider at fault: _describe or compadd?
> It would be trivial to fix in _describe, but I feel like it would be
> better to fix in compadd, so this problem cannot possibly occur again.
> I find it hard to believe it is ever anyone's intention to add a
> visible header when calling compadd -D (or -O or -A).
Yes, I agree. The problem is in compadd. With -D, -O or -A, it shouldn't
do anything besides setting the arrays.
The following is a minimal change that appears to do the job. It may be
possible to skip rather more of the code within compadd when any of
those options are set but that isn't trivial.
diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c
index 131e86825..63136854e 100644
@@ -2120,7 +2120,7 @@ addmatches(Cadata dat, char **argv)
curexpl->always = !!dat->mesg;
curexpl->count = curexpl->fcount = 0;
curexpl->str = dupstring(dat->mesg ? dat->mesg : dat->exp);
- if (dat->mesg)
+ if (dat->mesg && !dat->dpar && !dat->opar && !dat->apar)
curexpl = NULL;
Messages sorted by: