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 autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 3498 invoked from network); 26 Apr 2023 04:23:38 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 26 Apr 2023 04:23:38 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1682483018; b=gmuIZuBZK7LypZ2ehxU/1HOq3CPgGbCvsd6GmyLBWF8QlrVfRUSv0BLf89QolKDrx3P9FVJ1pr vs8hYXCwcaBiauNGlTq0tLHA2S2p0QA84CvtyPv5gyh/gItMuWjdHE0QhBntkcIAcAevQPKqkV UMkqy1ty5PotP4C4ouRjmmWpX1ULJmQ0BmZoOY3Rfo5TpjYdQA6v7JKWXfZi1FLNS7AYpSOTXN PwpJd2cbq64VS70kCHNlxkPPMGibjlY5cdQs4uw1BwPsX6U1je4YcgeoxMEgNwnCAuPL20OJ6A tLgO9FYso+3c5i6dsjo+YNKoAOuQQJoFf1S48JMLTZLsiQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (snd00013-bg.im.kddi.ne.jp) smtp.remote-ip=27.86.113.13; dmarc=none header.from=kba.biglobe.ne.jp; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1682483018; bh=i9vTmlT6AbKdXhHB2Ks2TdrfWfk6Ned5WK+6OMA7kI8=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Message-ID:In-Reply-To:To:References:Date:Subject: MIME-Version:Content-Transfer-Encoding:Content-Type:From:DKIM-Signature; b=Xl6+nzFxk2S7TYKoBn8cporxhGG25KrrPEyVJ+4yucQuQIrJBbQVTabI2xkw7RJ+aC8U+/vNWp oiDRRdu8ScCwtJZLHKu/91SxRNLSBNHWxOeuis7eUhovds3xZkbr9AURjwdwHzCZ1HBLvAeO++ fe5DRdGuWCas3rH+HUFU8lUXvNszSAIEBxFETmxG9rcQFWxs8vqN3BvG6oXekhTfuz2xiS6FZp ecRbmmiGCleTne0I3ayUhl/YAkcuAUdEgD4kgGGPg2amaKBLJgdIvo1GqYNU33Yfuo20xa558r LqecuvfXg0xKOtnnZn0EQjbZr/cZhsjhx+5CIInk4jiFIg==; 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:In-Reply-To:To:References: Date:Subject:Mime-Version:Content-Transfer-Encoding:Content-Type:From: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=7xCRvSwrRG1yyVNkR7UnagGuRZWP3xSRjyWDzJoj7LY=; b=BajrAHg9sn5xMvWsxVAScbYLrX fikrfF+bmxYc7BWFb5cZvZfAWOMEKHdZjOMBBeOfBH/qyo1rzS5II5Eu+rb2EglQryRvNjUYL45Tg 34QwJpQhwAFs3+fJZn+bYHaZuhlHfg/yZD7ty50dHhcTemirwzNVbqrGGZDu2/3TinKiGruNKLXln qx5NLLLfpnG4ghCUPBU76/jSZpio4YU8S6wprcqaMST/gsdSYN8qCzopz4BNJQjilYfPHAQbFq5g7 uZI8uKcLkbUk+fUKN/wttIPoiTLjaQBF2+CWGTOEkVOzyusKDGGXhCN2s+r3vpyVPv3DySSDC5TDG 33wFd1cA==; Received: by zero.zsh.org with local id 1prWgp-0007e3-2N; Wed, 26 Apr 2023 04:23:35 +0000 Authentication-Results: zsh.org; iprev=pass (snd00013-bg.im.kddi.ne.jp) smtp.remote-ip=27.86.113.13; dmarc=none header.from=kba.biglobe.ne.jp; arc=none Received: from snd00013-bg.im.kddi.ne.jp ([27.86.113.13]:44129 helo=dfmta0003.biglobe.ne.jp) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1prWgF-0007Lj-UV; Wed, 26 Apr 2023 04:23:01 +0000 Received: from mail.biglobe.ne.jp by omta0003.biglobe.ne.jp with ESMTP id <20230426042253933.NPCJ.20034.mail.biglobe.ne.jp@biglobe.ne.jp> for ; Wed, 26 Apr 2023 13:22:53 +0900 From: Jun T Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\)) Subject: Re: Autocomplete doesn't work correctly on certain folder names Date: Wed, 26 Apr 2023 13:22:53 +0900 References: To: zsh-workers@zsh.org In-Reply-To: Message-Id: <08777705-90D8-49AC-8DAB-02737F8D7DFF@kba.biglobe.ne.jp> X-Mailer: Apple Mail (2.3445.104.21) X-Biglobe-Sender: takimoto-j@kba.biglobe.ne.jp X-Seq: 51674 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: > 2023/04/22 4:59, Bart Schaefer wrote: > OK, thanks. The following matcher-list demonstrates the oddity: >=20 > zstyle ':completion:*' matcher-list 'm:{a-zA-Z}=3D{A-Za-z}' 'r:|=3D*' = 'l:|=3D* r:|=3D*' (snip) > Given the provided example of >=20 > my-longfoldername-firstname > you-longfoldername-secondname >=20 > I believe** the resulting partial completion should be >=20 > y-longfoldername- (snip) > ** I may be incorrect about the expected answer, the juxtaposition of > the prefix with the first hyphen also seems to matter. Please try putting a breakpoint at join_psfx(); this function is called with sfx=3D4 (i.e., true). When it is called for the first time, it does almost nothing, but at the second time, it calls sub_match() (compmatch.c:2493) } else if ((len =3D sub_match(&md, o->word, o->wlen, sfx)) !=3D = o->wlen) { Here, o->word=3D"my-longfoldername-firstname", o->len=3D3, md.cl->word=3D"you-longfoldername-secondname", md.cl->wlen=3D4. sub_match() returns 1 (=3D len), meaning that one character (the first '-' before the 'long') can be moved into the common prefix. Then, at line 2509: if ((joinl =3D join_sub(&md, *sstr + len, *slen - len, Here, *sstr=3D"my-longfoldername-firstname", len=3D1, *slen=3D3 (*sstr+len =3D "y-longfoldername-firstname", *slen - len =3D 2). But md.str=3D"-longfoldername-secondname", md.len=3D3. I first thought join_sub() should be called with the second argument "-longfoldername-firstname". This can be done by the patch below, and "apparently" it works: % cd long gives % cd -long-foldername- and hitting more s will work as expected. But if we look into join_sub(), lines 2221-2223, if (sfx) { ow +=3D ol; nw +=3D nl; } Before line 2222 (without the patch below) ow =3D str =3D "y-long...-firstname" and nw =3D "-long...-secondname". (with the patch ow =3D '-long...firstname"). Why these pointers need be advanced by ol=3D2 and nl=3D3? It looks as if join_sub() expects ow=3D'my-long.." and nw=3D"you-long.."??= I don't know what are the correct values for these pointers and lengths. I just hope my analysis will help someone to figure out the real fix. PS join_sub() tries all the matcher (including 'm:{a-zA-Z}=3D{A-Za-z}'). Whether there is a '-' or not matters because '-' is not in the range '{a-zA-Z}'. diff --git a/Src/Zle/compmatch.c b/Src/Zle/compmatch.c index ddcecd589..c9d4a3d24 100644 --- a/Src/Zle/compmatch.c +++ b/Src/Zle/compmatch.c @@ -2506,8 +2506,8 @@ join_psfx(Cline ot, Cline nt, Cline *orest, Cline = *nrest, int sfx) Cline joinl; int jlen; =20 - if ((joinl =3D join_sub(&md, *sstr + len, *slen - len, - &jlen, sfx, !(o->flags & CLF_JOIN)))) = { + if ((joinl =3D join_sub(&md, *sstr + (sfx ? *slen - len : = len), + *slen - len, &jlen, sfx, !(o->flags & = CLF_JOIN)))) { /* We have one, insert it into the list. */ joinl->flags |=3D CLF_DIFF; if (len + jlen !=3D *slen) {