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.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 24244 invoked from network); 7 Sep 2021 22:20:19 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 7 Sep 2021 22:20:19 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1631053219; b=SHdL+RoZPhAujB8nQJjXTjC9Hk7hpUNhd16TJc7NgAEloRKN+HOZ49okEeOygLPJEe7EYxohIy yK+2BLNq4gXAkOGEuH2hNLOM8ElXRPuALvC/h0T774E/DT9ptUYqYkiV1Bk2nYmK2j4yYSWHpY XgSjuHqqM37A3EmjNck8+HInipkZ6mB75juD3kBPvaEI4+7hn/UBlnUbr5qBkKhFdtdPmtMXvS Z7tUaUDpdWHm1JaeDn9qALGn31Z6PRhlhodDagZ0Hq4LtVSD66etFw6e3qq9NU0CdsSlUWvhkZ mE8RgPRb2NRa5DGX1pxMAnDafK8+MJeFalOGqeV11tiw+g==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-yb1-f182.google.com) smtp.remote-ip=209.85.219.182; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1631053219; bh=YYJnMV8HFArleZwePUtIwG18WXuzUWNONrQ7Q8C+cxU=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=XqE9O2zsEznrvbFPt11EeL5u9Omw2cR4gfckqlXQd5wU4CZ3Q018bbTz7Mo7RCXAWSCTSOlTib jC6129o1inoza2ytUet8MahTKCO5kA3lFFfhYWVVIeZw+qhjM4Cv7sBJE5v7hogvYhigYujUfz tfuB7vENMgwPXF7zOvT6Ou7LvQCrMqegNlxekf9QSRaLkmlVETJh2wJKJbPdqywiI84IKpWc2C Y3sDMKquqeEonPDjcju4GocpV8+TC/WUoHRUxYbHf0hM/weTCI0x/Gc0YhklbmpXCcp1YuyFFc LWAoMfGr1sZbCEkCR00BsVvOxBV2o0JfXhoxjiQ/qayzrA==; 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:Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=BLVy/J4uSLZ1VL2CoVmXLu4QskBwrH0Y2tYI61oL7I0=; b=BRoUBS2KaQTbXBNDE4KsCPIrfl UY0lXAOH3cy3bnvB7kofxillQ9fH065RMwugsPSDSZb+oJFcJ9PaVoDZqyCo/YkGnzDFP6DR2ncNh AlEMr7jk/r/TMFtxIwq7RFixki+OZ1y5Zxqra2stXUIQEL7KKjGnq+ZxOMWoagZqhGEehs/5lC7fy rok7pag0kiniOtacPnQJ+x5aawmgP19bR8t1lnCtWIyAlc5toWa+XM4rmTSdItbhWqJRmv4q8v4ph zZ3FdDuwhdq4qsPb4FmE2H3ePqfMNWtp4t4nj+dX9JV88d5RXkTQG20bKhpEQejdrb0ejRg4L6va8 ITpra5HA==; Received: from authenticated user by zero.zsh.org with local id 1mNjRy-0009hJ-Ul; Tue, 07 Sep 2021 22:20:18 +0000 Authentication-Results: zsh.org; iprev=pass (mail-yb1-f182.google.com) smtp.remote-ip=209.85.219.182; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-yb1-f182.google.com ([209.85.219.182]:42865) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1mNjRU-0009OA-8i; Tue, 07 Sep 2021 22:19:48 +0000 Received: by mail-yb1-f182.google.com with SMTP id v17so22100ybs.9 for ; Tue, 07 Sep 2021 15:19:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=BLVy/J4uSLZ1VL2CoVmXLu4QskBwrH0Y2tYI61oL7I0=; b=rDsuJ/3JVaretbEfGFYQ1Thz8r+ky4sWe1ruC8w/kSgk5QKI45Dx1c+zZZDsgWpGiV DJLLS6R1zs69wd+BvxgExk0wbw7Wjt0fpR16BIeX+cNkCWWyp5BaPadnaN5iSLf5NuMO ISE/sA9tB8ZbnXgz7S03jWWeVHWJivxMhhnTAdCqHJ5GoNzYExtMOkyok0zgnC0NWBrX oulV/ZE0qFOhbhfOMpfkT2lJTpz5O1VSxE9U5qoKN/3UkiUaKoPSwGq+S7jaWkVxuNlj Hk6R6kMPtI+LxkTY1aeSmfg9v2ZCcRRkiGDYJL0o9lQ37dFqjnTAMvE5xd8exOXMCz2W V6Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=BLVy/J4uSLZ1VL2CoVmXLu4QskBwrH0Y2tYI61oL7I0=; b=H+XDpu7ysQL1UfvNo1PXVu17nB5gv1KGSVydW3izFgl3IN2fpsEvToFW3FgppWdcse TSbMVlMOQeshIuvPQR4R8u5qU7h7g/R+4xid5NEB3G2hAne+tzztEDwP4oQsFhn1ZGGh QmC3IsUVJ/JNqVF3T65K2QofyjMJoDcgOOyTz2iWeF+FfGVOWgCBonDm/i2zGV6pivRR j1hvR2ehCid/Vx7/Dw6LlRfaeGL60MurdrIKrnrhe9bMJ/GG/OQpWvQlTFliCj0MFyHt 7khuklS0ltJGPg8CbMaG8rmPHuj8K8KRwBgFdi5O3qYuumNJDqy7si2rrk71FRBcizfJ tmOw== X-Gm-Message-State: AOAM5318brJ3ZA/61+CL0pxWaz+2itZBTs6ozngFkqWmJ8sgoSU9XsAq QDAbgxS4TOxqjQV4Uqm4+10aLi1T83naUyQOq4QCq0C8m4D3xQ== X-Google-Smtp-Source: ABdhPJxB43ro3RXxZArkh4cuTW2cDsh4Dk3NaO4npVKCCyLalV16ktj+issZ62v4LBatyxWvnSKUCyhezmZgg31MiXw= X-Received: by 2002:a05:6902:150c:: with SMTP id q12mr935887ybu.410.1631053186986; Tue, 07 Sep 2021 15:19:46 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Bart Schaefer Date: Tue, 7 Sep 2021 15:19:36 -0700 Message-ID: Subject: Re: [BUG] zle_highlight fails to highlight suffix added with compadd -R To: Marlon Richert Cc: Zsh hackers list Content-Type: text/plain; charset="UTF-8" X-Seq: 49387 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 Tue, Sep 7, 2021 at 3:07 AM Marlon Richert wrote: > > _tst() { compadd -S '' -q -- '' } > _tst() { compadd -S '' -r '' -- '' } > _tst() { compadd -S '' -R '' -- '' } > > With the first two functions, correctly gets highlighted as > autoremovable. However, with the third function, does not get > highlighted, even though it is autoremovable. -R is supposed to be followed by the name of a function. You gave it the empty string. That should probably have been an error right off the bat, but it does mean the suffix can't possibly be autoremoved. However, the same highlight behavior occurs even if you do supply a working subroutine. Does anyone remember why suffixfunclen needed to be stored separately? diff --git a/Src/Zle/zle_misc.c b/Src/Zle/zle_misc.c index 612ac2138..eba28d1ec 100644 --- a/Src/Zle/zle_misc.c +++ b/Src/Zle/zle_misc.c @@ -1508,9 +1508,6 @@ static struct suffixset *suffixlist; /**/ static char *suffixfunc; -/* Length associated with the suffix function */ -static int suffixfunclen; - /* Whether to remove suffix on uninsertable characters */ /**/ int suffixnoinsrem; @@ -1611,7 +1608,7 @@ makesuffixstr(char *f, char *s, int n) if (f) { zsfree(suffixfunc); suffixfunc = ztrdup(f); - suffixfunclen = n; + suffixlen = n; } else if (s) { int inv, i, z = 0; ZLE_STRING_T ws, lasts, wptr; @@ -1685,7 +1682,7 @@ iremovesuffix(ZLE_INT_T c, int keep) unmetafy_line(); } - sprintf(buf, "%d", suffixfunclen); + sprintf(buf, "%d", suffixlen); addlinknode(args, suffixfunc); addlinknode(args, buf); @@ -1800,5 +1797,5 @@ fixsuffix(void) suffixlist = next; } - suffixfunclen = suffixnoinsrem = suffixlen = 0; + suffixnoinsrem = suffixlen = 0; }