zsh-workers
 help / color / mirror / code / Atom feed
From: Marlon Richert <marlon.richert@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [BUG] _describe -x adds same completion group header twice
Date: Fri, 10 Sep 2021 11:44:26 +0300	[thread overview]
Message-ID: <CAHLkEDt_u77Yx6WRtwhrh19uGyKoL=a=P_j3L=PFPzkb_shC4A@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7YHoyioVFe9Kpw3bfP667z5N7WpW4uLCe0NoSFnvRbzEw@mail.gmail.com>

On Thu, Sep 9, 2021 at 10:04 PM Bart Schaefer <schaefer@brasslantern.com> wrote:
>
> On Thu, Sep 9, 2021 at 9:50 AM Marlon Richert <marlon.richert@gmail.com> wrote:
> >
> > When _describe is called with -x, it adds the same group header twice:
>
> I think this is probably the same thing as in the thread starting
> workers/48091 (Bug in compdescribe ...) that was partly addressed by
> workers/49211.

The problem still exists on master and it looks to me like it isn't in
compdescribe. Here's a diff on the trace output from _describe without
-x (a) and with -x (b):

% diff a b
8c8,14
< +_describe:36> shift 0
---
> +_describe:22> case x (o)
> +_describe:22> case x (O)
> +_describe:22> case x (t)
> +_describe:22> case x (1|2|J|V|x)
> +_describe:33> _jvx12+=( -x )
> +_describe:21> getopts oOt:12JVx _opt
> +_describe:36> shift 1
26c32
< +_describe:68> _next_label values _expl desc
---
> +_describe:68> _next_label -x values _expl desc
48c54
< +_describe:114> compadd -2 -o nosort -J values -X --desc-- -D _a_11 - foo bar
---
> +_describe:114> compadd -2 -o nosort -J values -x --desc-- -D _a_11 - foo bar
57c63
< +_describe:134> compadd -J values -X --desc-- -d _tmpd -a _tmpm
---
> +_describe:134> compadd -J values -x --desc-- -d _tmpd -a _tmpm
60c66
< +_describe:68> _next_label values _expl desc
---
> +_describe:68> _next_label -x values _expl desc
%

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
when used with -D (since the operation doesn't add any completions).
And because compadd treats -2 -o nosort -J values -x --desc-- as a
different namespace from -J values -x --desc--, the header ends up
being added twice.

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).


  reply	other threads:[~2021-09-10  8:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-09 16:48 Marlon Richert
2021-09-09 19:04 ` Bart Schaefer
2021-09-10  8:44   ` Marlon Richert [this message]
2021-09-26 20:21     ` Oliver Kiddle

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='CAHLkEDt_u77Yx6WRtwhrh19uGyKoL=a=P_j3L=PFPzkb_shC4A@mail.gmail.com' \
    --to=marlon.richert@gmail.com \
    --cc=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).