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,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 5917 invoked from network); 11 Apr 2023 09:50:07 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 11 Apr 2023 09:50:07 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1681206607; b=r7Fq88+2e7s3xbwVPYLbNnPpkNLfwaBlI9/NpdDYxvBDCB1SFt3258LjPV44yJrlIhNwFiX+np 0T1wp8zSO9Adq404Vr1fCBkBqpt1xzzSitMaFSUJ9rtitvy3kPHveDOp93cZUDW1iCQyv7ddav sfK0Sb5+9hHNyVEKHzvdGKqtjMFL28fGU1y4T4Ug3pWFbKzBP+MsC8BnrztHCSTAeldrQqqmZV myd1Upt3lW9yMyqHQ/vhU0uGcoggkRSoZ0aYewtQqmtyrkncaw96mWlQ86NZPGK0TMKSMZ1w0q EPwtv7DJfTmlV8MykitolqYczs2pJcicPNRKoonFgb4EcA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-oi1-f175.google.com) smtp.remote-ip=209.85.167.175; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1681206607; bh=i/JlJKILJC/PsJM9+0iSVnJ3FFxZNpKb0mG/+Fy27pk=; 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:MIME-Version: DKIM-Signature:DKIM-Signature; b=Y2yFK12nzUdvhrcipzaF46eBLqFl5lMPBSiB4XtyL+i7gtkhbO3eqL94bGNpxYQxDSfbpdBwON d+1XdTWkOVmazABfFbr7ZpfM+47ciwAsYkDLKRUDK259ZXbIxUrTiCmRiMqaICkwPjbsH3J6Zt H5Cv0etiRRcX3ILxK2l8Uv5wBKUeHO5H6keMdQBcgwJgK0EYstwC3q6qmN6d23bDaaaI4Bo9/D ry4nSCNQHGCpkOARFn07Wg3Q61tdIyWfpkn3wPgjpeEKwwi6b74rpuSeatrtGNw55/NVXio9vJ pk0sF69vDQufZdTx6u5Uh1YAB19R/8XTDIZlzkVQP+8O0g==; 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:MIME-Version:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=6IRMtR5kHOknUdztH+o5bz72FyzPyqLY37luSi3Nldw=; b=c+V85o7BDapEK5xflahmPdcCZp jzQHPqwKtdDo7u+JQdJnDeTKeIIjJeqhgt0AcYb30uBbhXrtecH3YNg0QmS16stH0RLHp2YJU8jmN 0w2AfyaO/cSEuPsk5F4ws6tGcDMfIu9i4jw6iJyx3c4aX3Lt01LtZX+df/2lJiWysFwI/SoxhH1gA VlISnAIJ582nOWOG3zPh1xnYkTlS3NQD9T0FPHeQTFIsENMx0qYDLbo/BANPARGsH9NnJLcuF6vo9 PC8yfiOTMTNb86MzhQJJ+78LmT91Rr3e+OwpezZMk9nJC4J/W7N3eomtd5yOhaQ/2ZQaQ2yGWnu3n 7LMAqCNA==; Received: by zero.zsh.org with local id 1pmAdY-000NGA-P1; Tue, 11 Apr 2023 09:50:04 +0000 Authentication-Results: zsh.org; iprev=pass (mail-oi1-f175.google.com) smtp.remote-ip=209.85.167.175; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-oi1-f175.google.com ([209.85.167.175]:44844) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1pmAdC-000MyS-Or; Tue, 11 Apr 2023 09:49:44 +0000 Received: by mail-oi1-f175.google.com with SMTP id bl22so22999352oib.11 for ; Tue, 11 Apr 2023 02:49:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1681206581; h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=6IRMtR5kHOknUdztH+o5bz72FyzPyqLY37luSi3Nldw=; b=Bz2KB6BRRX2RFQ5Rc2jrNKK+L6GQuuTuuXnup7/l6Lv86dqRZ5XslHlp5Cs6yk2xPV CBkQYZv2g3b60FMCXZPwovLMJ2JHOucAPnXNs2kSnz07Ycjm+6e/cXcEEZCbP9lqzMMF kbISQUNQtGsNd+DTdFz0vGFuEQUfWndXeNcb2JjPP2gGSOvlt57PKXM9qqR8xBFoZB7+ epbtZm3NX3FTUulcuI83Od5DU4NeFAesoCGEIvlIh6ZyT6QvTI21SXCpTyENiFHHbX65 nDTIEbMt/V8gUUL1TDZnt/yRfDjyTMTMpwYJJiRI6Zi/rUizalZNStUurk6KZvoMDEFW bCsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681206581; h=cc:to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=6IRMtR5kHOknUdztH+o5bz72FyzPyqLY37luSi3Nldw=; b=Q11FdPuM9GCoS5lfwo5g4bzsAevKcl8J8tBMHkbPisyP3GbUXROmrvmMH9gnwtbf9c UVx3zy8HRh+xh4brPVGDp7E/BRSSk/p3F6WW53WL/AOh6UR5/VR+KDg3mdovyC/kMpMf EI7hsuyrxZYEwjOA2nY/KDX6cLjBDTSH5LJuqooO2GisbEb2lxptSeQz0FJ9y0HkGX21 IU5/lQzdLGs6wXUWEOEu4/COqcwnOmuhGzupDWOVdUr6ik7GJAMbuCWST7sO0JTJufi7 d5XFDAhVlMQQdI6lIi00Y8bpXpNGObd/VdqxNsMNejBGrFfWBJHCbPLkbhxn1xwJpPz7 jtWA== X-Gm-Message-State: AAQBX9eino0DAEQPkzMBwT8iMmjwYECUpMdmuTTJSFBeUe/r18oG00x6 pEM1pKmiAWJWtLiLlIJoFJ8fWyTj9cbxGKtbTS0= X-Google-Smtp-Source: AKy350bTI5rTTDRgus2Hs1UuUVpOWLLhMvuoWyMSbCsSLWsMxbqdKeTAekRsOq7qY79U8ELwrMiY1qRoLmQyXoNUzOw= X-Received: by 2002:a05:6808:208e:b0:36e:f6f5:66a2 with SMTP id s14-20020a056808208e00b0036ef6f566a2mr561236oiw.8.1681206581074; Tue, 11 Apr 2023 02:49:41 -0700 (PDT) MIME-Version: 1.0 From: Marlon Richert Date: Tue, 11 Apr 2023 12:49:05 +0300 Message-ID: Subject: Re: Why is an 'x' appended in _prefix completer? To: Bart Schaefer Cc: Mikael Magnusson , Zsh hackers list Content-Type: multipart/alternative; boundary="0000000000000f1fb405f90c69f8" X-Seq: 51641 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: --0000000000000f1fb405f90c69f8 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable > On 8 Mar 2023, at 19:48, Bart Schaefer wrote: > =EF=BB=BFOn Wed, Mar 8, 2023 at 4:49=E2=80=AFAM Mikael Magnusson wrote: >> >> See the comment above addx() in zle_tricky.c and get_comp_string() (i >> don't actually recommend looking at this code). > > I always wondered why Sven chose to use "x" instead of, say, something > out-of-band / non-printable. I guess with metafication etc. maybe > there wasn't any such thing. > > Anyway, as I recall it, the point of the extra character is to help > completion distinguish the position of word breaks when completing > somewhere other than at end of line. I brought this up, because it has bugs. Here are two test cases, each of which uses the following setup: % mkdir foo bar baz % setopt completeinword % zstyle '*' completer _complete _prefix % autoload compinit % compinit % bindkey '\t' tst % zle -C tst complete-word tst *Case 1: Literal x is inserted into command line* % tst() { _main_complete compstate[insert]=3D1 } % file fbar ^ Position the cursor over here, then press Tab This results in: % file fooxbar *Case 2: Wrong character is set as autoremovable suffix* % test() { _main_complete compstate[insert]=3D1 compstate[to_end]=3D } % file bfoo ^ Position the cursor over here, then press Tab This results in the following, which at first glance looks correct: % file bar/foo However, if you then press Space, this results in: % file ba /foo If you use region_highlight for the suffix, the r is highlighted as autoremovable, too. --0000000000000f1fb405f90c69f8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
> On 8 Mar 2023, at 19= :48, Bart Schaefer <schaefe= r@brasslantern.com> wrote:
> =EF=BB=BFOn Wed, Mar 8, 2023 at 4= :49=E2=80=AFAM Mikael Magnusson <mi= kachu@gmail.com> wrote:
>>
>> See the comment abov= e addx() in zle_tricky.c and get_comp_string() (i
>> don't act= ually recommend looking at this code).
>
> I always wondered wh= y Sven chose to use "x" instead of, say, something
> out-of= -band / non-printable.=C2=A0 I guess with metafication etc. maybe
> t= here wasn't any such thing.
>
> Anyway, as I recall it, the= point of the extra character is to help
> completion distinguish the= position of word breaks when completing
> somewhere other than at en= d of line.

I brought this up, because it has bugs.

Here are two=C2=A0test cases, each of which uses the following setup:

% mkdir foo bar baz
<= font face=3D"monospace">% setopt completeinword
% zstyle '*' completer _complete _prefix
% autoload compinit
% c= ompinit
% bindkey '\t' tst
% zle -C tst complete-word tst

Case 1: Literal x=C2=A0is inserted into= command line

% tst(= ) {
=C2=A0 _main_complete
=C2=A0 compstate[insert]=3D1

}
% file fbar
=C2=A0 =C2=A0 =C2=A0 =C2=A0^ Position the cursor over here, then press Tab

This results in:
% file fooxbar


Case 2: Wrong character is set as autoremovable suffix

% test= () {
=C2=A0 _main_complete
=C2=A0 compstate[insert]=3D1

=C2=A0 compstate[to_end]=3D
}=
% file=C2=A0bfoo
=C2=A0 =C2=A0 =C2=A0 =C2=A0^=C2=A0Position the cursor over here, then press Tab
<= div>
This results in the following, which at firs= t glance looks correct:
% file bar/foo

However, if you then press Space, this resul= ts in:
% file= ba=C2= =A0/foo

If you use <= font face=3D"monospace">region_highlight for the suffix, the r is highlighted as autoremovable, too.
--0000000000000f1fb405f90c69f8--