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 12511 invoked from network); 10 Apr 2022 18:05:46 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 10 Apr 2022 18:05:46 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1649613946; b=puTWgjo7sffqhkXQdEoznDhR62M22OuisEv4M3gyeQpK5jqWwjG4lv/SBrryc8wxEq1/lg54dV oaLLztkq3seocXOXpf1Ml73GKz2Lg45P+twb0ZXCxP0m48DHwpSM8Eg6jq7aLGvpDE8DfwXzLD XlD+fymjLwMuDUTNHJIbRVjsp5roemzD7T+Yb1axzgyYsNPUWXulBrPJIOiyVlCD0HnGfyjHly OLlWiXAIDj0Di1JmCkAGGqiVNHxdSZf5IzNHNeHhEKiJB/Afn13/dZo95Z+Mu3YCUMNYtZLLIz aWAU21jYYbEeOlEwaNgDckR+RN7pE5jadKXExBOZpnwUrw==; 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=1649613946; bh=H1SB8aQyqYcZdF+pADDvDcqMbJVuoN3n0RhsXIK7XMY=; 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=BBusY1nS/8Qk4SOEnZlgFq7N9NUnMDcrpqrshqYYiXxwXG6l3wCLubHMs9quxgwwkMj82FQbFk TW9Wvkp0LC0ozabJlRzz+43GNbA/g9X+IUbju/7gsFJymSQ8Jb52RTpukpe/LQzmziKQefaxUe 1CNr5RGMayyPJh2+CIWsvnLOAsvg9P/LtIu+eIjhRpE2dcwtRdENtRq/hUHn6nB90XS6ujE2iF Zo0odVFelwAKoj5Mb/M3PBUVYNCmdAmTlXTA8P6jFN0rEcAjtZeq9dYZI7lW1vGAeeItZUzDST Lredt3XZUiHR5hxQtBjo8Y+a1KHlqEAZNMG26jw7vLu6yQ==; 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=tC+w4Wjlv1FbMz5aD4Ak8dRbYNAACbX2NDBMU6gTWMA=; b=PMNqH2Nvkh/YSLlwwjdC9D6t4e ffp+5b2+7IvfCFedgBQTc0wha9/e6h1i5XISyS8WHQf6xWB83vmVSGja/kylaoCYukmMR5MdZeDDy 3fqUgtNTqoiCTdl5te5V9t+h8FNhw06Kdd84Y59yxhSLFmwLifopVucOzO5pssCsxUg3Qprf+rkIR W1DIacg3n2qKIIZweYcJ97Ev5LUtL4fW9ej7ojnvIIZ1ZXJMPQ4JHieUTeKIGLhf3kjyV4q/1hoTN SabgdlWWl7GAoqAo860ssRp8kN6ro/vu3LAqt3GSU5Br4xBpSN/A2K7dLRzAOuvDXx7F+FfnCXVeL yN9ls25g==; Received: from authenticated user by zero.zsh.org with local id 1ndbwX-000KMD-Pt; Sun, 10 Apr 2022 18:05:45 +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]:34917) by zero.zsh.org with esmtps (TLS1:DHE-RSA-AES256-SHA:256) id 1ndbvy-000JfW-PF; Sun, 10 Apr 2022 18:05:11 +0000 Date: Sun, 10 Apr 2022 20:05:09 +0200 From: Tomasz Pala To: Bart Schaefer Cc: zsh-users@zsh.org Subject: Re: cd /u/N/v/ tab expansion Message-ID: <20220410180509.GA26578@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> <20220410174551.GB22715@polanet.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline In-Reply-To: <20220410174551.GB22715@polanet.pl> User-Agent: Mutt/1.5.20 (2009-06-14) X-Seq: 27657 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: On Sun, Apr 10, 2022 at 19:45:51 +0200, Tomasz Pala wrote: > ...and THIS doesn't work with SUFFIX="*/d/e/g*" - therefore I did: > > > - compadd "$tmp4[@]" $listopts - "$i" > + compadd "$tmp4[@]" -U $listopts - "$i" This with list-dirs-first has one issue: $ ls u/s*/ax -- cursor over 'a', tab menu cycling [directories] usr/share/aclocal/ x usr/share/atever/ x [files] usr/sbin/a1 usr/share/a1 usr/share/a2 Note missing ' x' after completing files. Is that -U dropping the SUFFIX? > > - [[ -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. This cycling (ctrl-g toggling of behaviour) means something is not being reset/unset properly and should be fixed. However the latter case: > $ 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/ with cursor over first of "//" also differs from the first run (the correct one). This is caused by MBEGIN and MEND variables being set in both cases (add-space and not). If they are about to be kept between the completion invocations (even after the ctrl-c), they should not be used in completion functions. Otherwise they should be cleared not to leak some bogus state into consecutive invocations. What is the purpose of MBEGIN and MEND? > Both of the solutions also seem to fix the list-dirs-first true issue! -- Tomasz Pala