zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: martin.ebourne@arcordia.com, zsh-workers@sunsite.dk
Subject: Re: Bug in _approximate with ~/
Date: Thu, 16 Aug 2001 17:45:01 +0000	[thread overview]
Message-ID: <1010816174501.ZM12190@candle.brasslantern.com> (raw)
In-Reply-To: <OF524CF0A0.53B4D539-ON80256AAA.00568ADE@uk.jpmorgan.com>

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   


  reply	other threads:[~2001-08-16 17:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-16 15:54 martin.ebourne
2001-08-16 17:45 ` Bart Schaefer [this message]
2001-08-17  9:16   ` Sven Wischnowsky
2001-08-17 14:36     ` Bart Schaefer
2001-08-20 13:11       ` Sven Wischnowsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1010816174501.ZM12190@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=martin.ebourne@arcordia.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).