zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <opk@zsh.org>
To: Marlon Richert <marlon.richert@gmail.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [BUG] _describe -x adds same completion group header twice
Date: Sun, 26 Sep 2021 22:21:05 +0200	[thread overview]
Message-ID: <26395-1632687665.183328@blev.Tuug.s4Lk> (raw)
In-Reply-To: <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.

Oliver

diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c
index 131e86825..63136854e 100644
--- a/Src/Zle/compcore.c
+++ b/Src/Zle/compcore.c
@@ -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)
                 addexpl(1);
         } else
             curexpl = NULL;


      reply	other threads:[~2021-09-26 20:21 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
2021-09-26 20:21     ` Oliver Kiddle [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=26395-1632687665.183328@blev.Tuug.s4Lk \
    --to=opk@zsh.org \
    --cc=marlon.richert@gmail.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).