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 autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 17544 invoked from network); 23 Nov 2022 21:37:33 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 23 Nov 2022 21:37:33 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1669239453; b=cw6HhJRfqzoFpj/ba8K5TgpHpgUP7CzxEHuKCaLAxBn/vOrCDj13o5yR/uUGy6saMH3+DejMnl hl5mt3YdsDMOaxyaElZ5YB+Fj+EqpEb0yqNxv7TPSs8GH47CpNt+Rjpeq5FIuuhYsLI9oalb7D +wvSLlZGzBKiKV9h1Uh472BgwIBRA+DI805PSG5QepFTcB4wIou8LOG4DqzH7I9LOJMJMicrYm mR5SRwaohFRmL0/Fgy8AHcXjQzweMggA7HyLvyrhPIFvHndlxa8maFpMwkNCBqGhQIFurLTpwN H+Bk6tETC/KDkyJrbO8KM52GCtirPOc1tGLlUOr02MKYWQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ej1-f47.google.com) smtp.remote-ip=209.85.218.47; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 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=1669239453; bh=96xeLaIKKgWWDC0TmpVEzCBI5Vaf+m9Q1CUueHDNiBM=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Cc:To:Subject: Message-ID:Date:From:In-Reply-To:References:MIME-Version:DKIM-Signature: DKIM-Signature; b=YhaPa5RXpPlOsThwqT8TLNa7UNV/VDyMO6T552ykzKO+V7Ied5/5dO99ws0XU0OYmI/0gTHLw6 cCAfWcMcNn4hI+m4CnwCxTAhPIa0yBpm0pk2K0xBgA96wJR489hZEdwseztESxza2BEP06cnKL UpImVXQz/hjTezj/BBxd4aMWI0oizn4n4SImQhfy3m5yyATr/7UQIfKqSMJGA+9YVNhIKv5WKO oA4zL5QMtL2QRaafvS7829SCI4HhRSkhA4P1e7NaJsiJN1tOWAd9ACIyXaS+9Psy+Hf807Ay/0 Tv5BgB6kJtWtTAFdgqHK9SmH6u7bPTWTDWHDXiqqJez+hw==; 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-Transfer-Encoding: Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=z7QDxZeeo1qFLIoT/nz/vemKSB/yQFA5IMrstH9If5w=; b=ajZKBLs/u8Fk4waekVlkplU8On DlxrweUY0KeWtCFeYd1LNQnSQpdsiSzay9bfQytiVga/nSbZo7mA852s1LA4K0uNrDajHXA98bEU+ h2mbKEpZ+eCgMsBc39zMiAPdhZnOOrRCQgyC2L7NX8saHgrsd7Fqx1VrnJlsdnbIXarYm1+UbHULD DYDQrX2i9O2pnFzLfWH1jGa3x+8qOzaz62uLmkj/8aoOL/8mEb7CNmInZ6hN+BoMwkp67jtQva4Fm yAZi9Stssdk6Nejx1rygii22+796TmmacTG/1qojpqNsYZ2NUFE6FvnTQnQ/PrGDBaSIwbCQEmkOt sKgLfqYw==; Received: by zero.zsh.org with local id 1oxxQy-0001Lf-IJ; Wed, 23 Nov 2022 21:37:32 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ej1-f47.google.com) smtp.remote-ip=209.85.218.47; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-ej1-f47.google.com ([209.85.218.47]:45748) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1oxxPf-0000v3-Ru; Wed, 23 Nov 2022 21:36:12 +0000 Received: by mail-ej1-f47.google.com with SMTP id e27so86260ejc.12 for ; Wed, 23 Nov 2022 13:36:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=z7QDxZeeo1qFLIoT/nz/vemKSB/yQFA5IMrstH9If5w=; b=ZBKQkKYNnUUsXr/CV0rtffIO8ofKu+q7XnY1h7Fcv8LTY9rrOzf8etzCcFHWFHOp5c F1QYZYM7Ql31OHApCoBrFz2rOdAqqd81fXF+d7j/VAJeB3qUym6n7k3LV4q9H2A88ovo /KkkRe2ehAIvPFCIKBu741WMufPWIi0hDl9v5WHNkaQ076QWdpMfWpiOX2urNIScTDei akjLFp25UNX9FNqr/IJaVndL4C8bs4DmoGiT44VQYA5ZJ9VPNhIjfew5opatFuR2OCu2 mryZdW2dpah5Lj1KW4doDgesYIGf+0uNELDVObgOSWMCfOJ/t3+1XId+8cQz6aAvImSi jHoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=z7QDxZeeo1qFLIoT/nz/vemKSB/yQFA5IMrstH9If5w=; b=ix+3+6C21GAfWr/7UrBuHk7unFwk4h2kvLca04OzorOopcsCv311zleH3IJSnhGTN4 Z/fCfL0VYagLzpNCG/MDsot14nbfeWi7McJYqleIIMWQ7IKqw3Ltz1dkPFlHED3JHnjl UyGIHZBRvSp+BsUzSVCSYV/jPfJjoMjtYKMe4g8DGFIGi13xyRM0pOFOqmtM+C/65mEZ QK9jUMYjMALMEqj6jm1z6GCRPOsS+OsUqJlQ0O7CHad7r6ovzQRkH26GPXj00Kow83Y2 plyp3fpxbdPzrsHH8Hbmwxxskd/YF9CQIin2xt9madqHvmcWN8utOenpUvjiz4ZWN5e4 Jn8A== X-Gm-Message-State: ANoB5pkaPXJpLFOVeiMfw+CiYc+YeENnRm2ilt5cSP64qhOhamUrO9KY NHbkjRMP0AAYCcWrJC6kDOtQgzrekbiSjaEc8GnHIj9eR+Y= X-Google-Smtp-Source: AA0mqf7iVQ+VspKUl7NrYuH4kyanOrAGdcmF2vF5XuR4koVYI+/nfYipvrWroynlS0S+CxfjleOeTe6gRIM/Il8qRTw= X-Received: by 2002:a17:906:49c2:b0:7aa:23ac:608e with SMTP id w2-20020a17090649c200b007aa23ac608emr8883599ejv.450.1669239371525; Wed, 23 Nov 2022 13:36:11 -0800 (PST) MIME-Version: 1.0 References: <45820bd7-fab6-70f5-5abb-dc444f6f1075@coldfix.de> <20221123141357.GL27622@tarpaulin.shahaf.local2> In-Reply-To: <20221123141357.GL27622@tarpaulin.shahaf.local2> From: Bart Schaefer Date: Wed, 23 Nov 2022 13:36:00 -0800 Message-ID: Subject: Re: Path with spaces in _canonical_paths To: Daniel Shahaf Cc: zsh-workers@zsh.org, =?UTF-8?B?VGhvbWFzIEdsw6TDn2xl?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 51043 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 Wed, Nov 23, 2022 at 6:14 AM Daniel Shahaf wrot= e: > > Bart Schaefer wrote on Mon, Nov 21, 2022 at 13:32:41 -0800: > > On Mon, Nov 21, 2022 at 9:41 AM Thomas Gl=C3=A4=C3=9Fle wrote: > > > > > > + local -a tmp_buffer > > > + compadd -A tmp_buffer "$__gopts[@]" -a files > > > [...] > > > + matches+=3D( "${(@)tmp_buffer/$canpref/$origpref}" ) > > > else > > > # ### Ideally, this codepath would do what the 'if' above does, > > > # ### but telling compadd to pretend the "word on the command l= ine" > > > # ### is ${"the word on the command line"/$origpref/$canpref}. > > > - matches+=3D(${${(M)files:#$canpref*}/$canpref/$origpref}) > > > + matches+=3D(${${(M)tmp_buffer:#$canpref*}/$canpref/$origpref}) > > > fi > > The comment quoted above concerns how the candidate completions are > compared to the word on the command line. The comment says that, > instead of applying s/foo/bar/ to the word on the command line and > comparing the result against the raw candidate completions, the reverse > is done =E2=80=94 s/bar/foo/ is applied to the candidate completions and = that's > compared to the raw word on the command line Hrm, but in both cases (even before the diff) the substitution is s/$canpref/$origpref/ ? Your explanation here would seem to imply that in at least the second case the substitution should look like s/$origpref/$canpref/. The difference is that in the first case $tmp_buffer is the result of filtering with "compadd ... files" and in the second case we're altering the elements of $files directly. > Adding or removing -Q or {(@)} (or ${(b)}, cf. workers/39080) might well > be independent of that issue, though. I believe the difference here is also compadd -- it performs the quoting changes that -Q then has to account for. So when we modify $files directly in the second branch, we have to also emulate the quote behavior of compadd. My previous suggested patch perhaps didn't go far enough in that direction?