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,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 9944 invoked from network); 10 Apr 2022 17:47:15 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 10 Apr 2022 17:47:15 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1649612835; b=QK6P/nThNQWYMGf3nPnO7l7NBItirhQbho9VgQKzvT3Qn1p7u1nPpr/wLXua+wTzcoZa7kfnzZ BjaJ4RB5BUYQOkUUM86IWfTuccc3Cph8I+88oJri+TZlXP78Y9drs0nps1RGzNifrygMaJ1W13 XfkofiXjQbwhtAfHft2dBL+TPeMm2kVC5WJJnF3Bzk0kNj2bXfLczTVItuLmnLz8sEvJUnwgmm AJPvqCSwthvZsF6mOfu6YFsBATsAg3A6ZfAqUdvxQPUl8sDgCm9bZ/CISQIyfdkXo446FR7SWl RQRUT5VKhDu9j6NkkBjkIIV6BAWOx0qRuwuDJn6/w9SAaA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (pepin.polanet.pl) smtp.remote-ip=193.34.52.2; dmarc=none header.from=polanet.pl; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1649612835; bh=rC8iyiAXWdjkswvzLBNSRvx63lpyhQWGVxi6tgH6HxY=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:DKIM-Signature; b=eJR0z1hiyVWeZLWtStwzP8ZpQcHnFcme+XdTgmhoI0nBo425tU6DnuQB+tL5ac+mvb+4t0qvJ0 NunGLfCsj17/EKO2+y0sAiTuwWJzyzl7WoIFYxAdTN+IejniQu5IiVIE8743Zi9w+eQPekV84b lQ4u0xy7fta/KDDAheK2uELkWxSFnEfH5AgaCxJqLGvXlDi3UDbiuelJI8ylVL7ufqLajGrVHK wXFbPE3VAQvwbSZSIaNI6L/bTK/aozeB4gRNcNv1DPR6nAiBB/oQxO/WHzo9AZzfaThV16i6S5 Pk/zGFEfu4JpDPQt23bs49c+1cTlOEFtKzREpgckwvezPQ==; 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:In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=T+SZAzTo/VoOAtZxsG4YHSxyJ3BjlfiZ8Qkd45eDcoc=; b=lfnTk/V9HNA21K2n2O68x0LB8q oWTRPTuyx7geRSjz7d6JhWMgvrBpsxdaLRTjx1ARw9ICWfhWbSbU2MT5XqVm4n45IYpKQ0T/vdGCJ bVDOYqflRkA677kYFvnHrgg38Fx5CuOIbqpkdx6r/qf4+24xpDjdLYogTaezZQBfJ84dXZeLhSyS7 mrnO13zQawBhU/ajPAWmGbLFLIY9J/L6e5nVU1pumEaFKnxuKwS/HJU0nBjcXPaP7WE0arfwo9hld xFZ+momTj2YG8y3Se4u7neyfpbVeQdxXr9TcGVjWq4+zUVnRGNXkJWkR1lYQtGR+wYBfBYF1dMW49 a4hNnigg==; Received: from authenticated user by zero.zsh.org with local id 1ndbeb-000IpL-Qm; Sun, 10 Apr 2022 17:47:13 +0000 Authentication-Results: zsh.org; iprev=pass (pepin.polanet.pl) smtp.remote-ip=193.34.52.2; dmarc=none header.from=polanet.pl; arc=none Received: from pepin.polanet.pl ([193.34.52.2]:34453) by zero.zsh.org with esmtps (TLS1:DHE-RSA-AES256-SHA:256) id 1ndbdI-000I6F-Rm; Sun, 10 Apr 2022 17:45:53 +0000 Date: Sun, 10 Apr 2022 19:45:51 +0200 From: Tomasz Pala To: Bart Schaefer Cc: zsh-users@zsh.org Subject: Re: cd /u/N/v/ tab expansion Message-ID: <20220410174551.GB22715@polanet.pl> References: <860877fd-ec69-0323-3f2a-8a40e96e6aee@rayninfo.co.uk> <2b388cce-1412-36cd-9a90-d58f853ee830@rayninfo.co.uk> <20220410010441.GA24829@polanet.pl> <20220410143222.GA21848@polanet.pl> <20220410162751.GA21675@polanet.pl> <20220410163236.GA22715@polanet.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline In-Reply-To: <20220410163236.GA22715@polanet.pl> User-Agent: Mutt/1.5.20 (2009-06-14) X-Seq: 27656 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Apparently compadd uses the $SUFFIX env behind the scene... compadd -Qf -J argument-rest -X %Bfiles%b -J globbed-files \ -M m:{a-z}={A-Z} -M m:{a-z}={A-Z} -p a/ -W a/ \ -M r:|/=* r:|=* - b1/d/e2/g ...and THIS doesn't work with SUFFIX="*/d/e/g*" - therefore I did: - compadd "$tmp4[@]" $listopts - "$i" + compadd "$tmp4[@]" -U $listopts - "$i" Actually I might have an idea why the original code doesn't work - see, the "*/d/e/g*" is a pattern... that doesn't assume "e*" for "e2" part. My original invocation wasn't a pattern, but "a/b/d/e/g" that was about to be completed with the list-suffixes style as "containing multiple partially typed pathname components"; however, the glob_complete sets the compstate[pattern_match] which results in: "wildcard '*' is assumed at the cursor position". So, the correct solutions seem to be one of two (or maybe both): 1. either use the compadd -U flag as above or 2. properly mangle the SUFFIX (the 'g' global flag for substitution) - [[ -n "$compstate[pattern_match]" ]] && SUFFIX="${SUFFIX:s./.*/}*" + [[ -n "$compstate[pattern_match]" ]] && SUFFIX="${SUFFIX:gs./.*/}*" The second solution doesn't play well with add-space style: $ ls a/b/d/e/g[tab] b1/d/e1/g/ b1/d/e2/g/ b2/d/e1/g/ b2/d/e2/g/ [ctrl-g] $ ls a/b/d/e/g[tab] $ ls a/b1/d/e1/ /g ^ cursor position b1/d/e1/ b1/d/e2/ b2/d/e1/ b2/d/e2/ [ctrl-g] $ ls a/b/d/e/g[tab] b1/d/e1/g/ b1/d/e2/g/ b2/d/e1/g/ b2/d/e2/g/ and so on, over and over again. $ zstyle -d :completion:\* add-space $ ls a/b/d/e/g[tab] $ ls a/b1/d/e1//g b1/d/e1/ b1/d/e2/ b2/d/e1/ b2/d/e2/ Both of the solutions also seem to fix the list-dirs-first true issue! -- Tomasz Pala