From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15612 invoked from network); 16 Aug 2001 17:45:51 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 16 Aug 2001 17:45:51 -0000 Received: (qmail 4373 invoked by alias); 16 Aug 2001 17:45:42 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 15648 Received: (qmail 4355 invoked from network); 16 Aug 2001 17:45:40 -0000 From: Bart Schaefer Message-Id: <1010816174501.ZM12190@candle.brasslantern.com> Date: Thu, 16 Aug 2001 17:45:01 +0000 In-Reply-To: Comments: In reply to martin.ebourne@arcordia.com "Bug in _approximate with ~/" (Aug 16, 4:54pm) References: X-Mailer: Z-Mail (5.0.0 30July97) To: martin.ebourne@arcordia.com, zsh-workers@sunsite.dk Subject: Re: Bug in _approximate with ~/ MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Aug 16, 4:54pm, martin.ebourne@arcordia.com wrote: } Subject: Bug in _approximate with ~/ } } % zstyle ":completion:*" completer _complete _approximate } % mkdir -p ~/test/test{1,2} } % ~/test/f } } Press tab immediately after the 'f', and I get: } } % \! } \! * - . 0 1 : @ X \[ } e r test1/ test2/ w \{ \} } ~/test/f } } Which wasn't quite what I expected! ;) ~/test/f is in command position. Therefore it gets compared to parameter names, reserved words, aliases, command names, file names, job specifiers (%1, %2, etc.), and some other things I've forgotten. It doesn't match any of the above, so you get offered a bunch of possibilites, some from each of those sources. If you were to menu-complete through the list so that you could see the suffixes that get auto-appended to each one, you'd get some idea where they came from; for example, X e r w : - and dot are commands. In _approximate there's this snippet: ### This distinction doesn't seem to be needed anymore # if [[ "$PREFIX" = \~*/* ]]; then # PREFIX="${PREFIX%%/*}/(#a${_comp_correct})${PREFIX#*/}" # else PREFIX="(#a${_comp_correct})$PREFIX" # fi This results in a PREFIX that looks like `(#a1)~/test/f'. _path_files does the right thing with this -- it peels off the (#a1), expands the tilde, and then applies (#a1) to each path element. However, none of the other completions that are attempted in command position are this intelligent -- they all interpret `(#a1)~/test/f' as `(#a1)()~/test/f', that is, allow one correction to the empty string as long as that does not match `/test/f'. Consequently you get all the one-letter commands, parameters, reserved words, etc. You're right, this is a bug. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net