From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2314 invoked by alias); 24 Aug 2016 05:51:52 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 39095 Received: (qmail 21289 invoked from network); 24 Aug 2016 05:51:52 -0000 X-Qmail-Scanner-Diagnostics: from mail-pa0-f42.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.220.42):SA:0(0.0/5.0):. Processed in 0.168583 secs); 24 Aug 2016 05:51:52 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at brasslantern.com does not designate permitted sender hosts) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=ZOHsJlIhKmwu7lTAIWaXrWJxtR9PSgfPsaUhoZOjyTg=; b=L0etL36vAjjA1VlqEIhZRR4FE1LgsTOUq/1dhXb9Tm2dKqXh097L35JkOIRR0LoKND XlmoVqfFIFy9hvuZ9NcWeytoxdWqKVTOxYZbtNZf7NjFeprfaV4Q+kqVK+S1qNfTWM+b /fClVjHdw1/kYp72M27ASNj12qYFquPOQs9E9UsRB1xp1L+YEe4ASzPxhb9M+plzyjgM rlNEC5AQoqhDce80xdTh1xSVAT12qC/inoRUM2my2GJcnhEXDhF7E9aBjCas6XqZphr9 QRbbCBg9+7vZtZblpl9fKLuQUZA+G1z/86/buheL+q7LaVuBoEYn6XaBm8jUtCtd8t/u Rv2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version; bh=ZOHsJlIhKmwu7lTAIWaXrWJxtR9PSgfPsaUhoZOjyTg=; b=Yl9IFbmJI6J/m57J2Xn0Wlfl/OtNmP6RAE5V0fvWiPN47B9WBz0Ii/ARVAx9hNFJR/ 4vPofTPVzV4i+yaXS+iIoyNkYI0u5/7/qA2F6pFWrjaHmz87xet0V4Vr/OeBg0dpSkqH ElM5J61mrL/fb4jwYHkuFHx1mwyMhF060pd7rHOoYpFS16bM4VlcyP4vwZmyTS6LiKBx 33ohbTqDIc47Ed+txLUJHiNZ8+IJZ80yM1DUN7hKZY2WNOVMTCje/UcYsdDMLkdsjlBg 7l2UilsxWXMxaVfELIQhWIShl5LB50cCTU+4Vmavl0XgsAEXN/7drFX5uUbTmNz+OIjq C9kw== X-Gm-Message-State: AE9vXwNMFDaU7NRjIxlx8MF/6jMt+q3GL0Uv+2hMkwtWk937TSHuaLoRDTixuXoarFBW6g== X-Received: by 10.66.153.163 with SMTP id vh3mr2443796pab.0.1472017905441; Tue, 23 Aug 2016 22:51:45 -0700 (PDT) From: Bart Schaefer Message-Id: <160823225204.ZM19950@torch.brasslantern.com> Date: Tue, 23 Aug 2016 22:52:04 -0700 In-Reply-To: <20160823224842.GA24864@fujitsu.shahaf.local2> Comments: In reply to Daniel Shahaf "file completion(?) erases word typed" (Aug 23, 10:48pm) References: <20160823224842.GA24864@fujitsu.shahaf.local2> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: file completion(?) erases word typed MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Aug 23, 10:48pm, Daniel Shahaf wrote: } } I noticed something odd in a completion function that (eventually) calls } _path_files: } } % git config sendemail.smtpserver <^C> # autoload } % compdef __git_sendmail_smtpserver_values f } % f /usr/bin/gtk-update-icon-cache-3. } % f } } It erased the word I'd typed. I'm not certain what's going on here either, but loading up a few more zstyles and using a completion that's not unique might have provided a hint: torch% f zsh- torch% f /usr/local/bin/zsh-5 Completing hashed command by absolute path /usr/local/bin/zsh-5.0.2-dev-0 /usr/local/bin/zsh-5.0.8 /usr/local/bin/zsh-5.0.3 /usr/local/bin/zsh-5.1 /usr/local/bin/zsh-5.0.4 /usr/local/bin/zsh-5.1.1 /usr/local/bin/zsh-5.0.5 /usr/local/bin/zsh-5.2 /usr/local/bin/zsh-5.0.7 Completing file zsh-5.0.2-dev-0* zsh-5.0.5* zsh-5.1* zsh-5.0.3* zsh-5.0.7* zsh-5.1.1* zsh-5.0.4* zsh-5.0.8* zsh-5.2* Note that it lists the individual files as possible completions. For one of those to match the command line, the /usr/local/bin/ prefix would have to be erased. Repeated whacking of TAB at this point menu-cycles through only the "hashed command by absolute path" selections, the base file names are never offered. If I append the "." and use list-choices (^D) I get the same listing as above, but as soon as I hit TAB instead, the whole word is erased like your example. There are a couple of curious tidbits in the _complete_debug traces. Here we add the command path but tell completion that the path prefix should be removed from the resulting command line when completing: +_hashed_absolute_command_paths:6> compadd -M 'l:|=/usr/local/bin/' -J -default- -a 'commands[(R)${~i}[^/]#]' Here we add all the base names but say the path prefix should be pasted back on -- but (weirdly) that the path without its leading slash should be an ignored prefix: +_path_files:713> compadd -Qf -J -default- -p usr/local/bin/ -s '' -W /usr/local/bin/ -M 'r:|/=* r:|=*' -a tmp1 I have no idea why ignoring the path minus its leading slash would ever be correct, but in any case this appears to be adding the full path by two different and contradictory approaches.