From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 25419 invoked from network); 26 Sep 2021 20:21:23 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 26 Sep 2021 20:21:23 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Message-ID:Date:Content-ID: Content-Type:MIME-Version:Subject:To:References:From:In-reply-to:cc:Reply-To: Content-Transfer-Encoding:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=vz//+6uyN7OshhY53Sv4LLCFX3XadDx9nFLjnqUz8Q8=; b=QqbT/TI5/CEn5w999UtCE4d5uU hit/FLOLhDkXlWvxuLm/420/jinj5KS9UuyGzz/ge/oDFoq4BksydK6V6rbvAplowALdvl640+hP/ 0OtStvqy8ybPSc9cYi5qsfnxB8v3Sl9Lu5PuXQSMJ1qLfHT5QWvv5jkLjFjkTPMlc7R//OUuaXBE8 s+eCJaZ8a5AkBDCjfjfx46eK347Afc/oVgx8TdnZN1Szj2WCIleRx8M+EyeNF5I0wyND828rkKxJi hGadUoLmJfldQLCuzHDik/oG8F2m7yV/+bNqjCevV30XYfFh6TCv3I4AKseb2lr8U5jKv05AwQgLb mwsKO5iw==; Received: from authenticated user by zero.zsh.org with local id 1mUaeI-000OER-Kh; Sun, 26 Sep 2021 20:21:22 +0000 Received: from authenticated user by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1mUae2-000NyR-Dl; Sun, 26 Sep 2021 20:21:06 +0000 Received: from [192.168.178.21] (helo=hydra) by mail.kiddle.eu with esmtp(Exim 4.94.2) (envelope-from ) id 1mUae1-0006rk-64; Sun, 26 Sep 2021 22:21:05 +0200 cc: Zsh hackers list In-reply-to: From: Oliver Kiddle References: To: Marlon Richert Subject: Re: [BUG] _describe -x adds same completion group header twice MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <26394.1632687665.1@hydra> Date: Sun, 26 Sep 2021 22:21:05 +0200 Message-ID: <26395-1632687665.183328@blev.Tuug.s4Lk> X-Seq: 49450 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: 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;