Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH Re: squeeze-slashes false not working?
- X-seq: zsh-workers 29289
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: PATCH Re: squeeze-slashes false not working?
- Date: Sat, 14 May 2011 20:31:24 +0200
- Cc: zsh workers <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=hQelBAOahq2Ni3LVZ/PGYUcOOVrPvZGP8qKh4FXE8pY=; b=WuNMaq00DM6ir1JspIw1AUz3gievamYcn1VxNGAsF0HKw/FbmPPeq9FeRlzFG9Xsnh E7oE1UFTx01IUZdLLQ8umZuYiCpkyYrENn38jBERBtWcsaHp++MEQXrJi0kGBlH6HXt0 rfcdLzZQsCf+6Q58QjNRak+GtJbF+0NGjly40=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=k25QCtj3BV4rgSngUPyrD3uZM3evBbsbXGgewNvwGPfls/NMr4I6VjMpCn4x+24GOC RqttyHl8wkfg4UCImjIpQeSlWzImS2owYBFMFSdSJkUeNjRhEany+SPkiPTTDhnqmYk1 s07kBcQSBobxAQcupk814LCkbZ77XHAYrN2C0=
- In-reply-to: <110513225805.ZM13712@torch.brasslantern.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <BANLkTikqnR3pJk8FzRT6Qo9J+wTMGSnycQ@mail.gmail.com> <20110513191710.657d2f61@pws-pc.ntlworld.com> <BANLkTi=KyDfiM1YqXR0q1w-PxiAeQ0thdQ@mail.gmail.com> <20110513195324.6ab90eb2@pws-pc.ntlworld.com> <BANLkTi=7vnGkz2uPTyd3Br019SuxV5_Q2Q@mail.gmail.com> <110513225805.ZM13712@torch.brasslantern.com>
On 14 May 2011 07:58, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On May 13, 10:07pm, Mikael Magnusson wrote:
> }
> } Okay, I'll try to sum up :). Starting from zsh -f + compinit, with
> } path-files on and squeeze-slashes off (the default), I get this
> } behaviour: ls ////<tab> jumps back to the first slash and allows me to
> } complete components in /.
>
> Yep, I get that too. But once something is completed (e.g. /home///),
> subsequent completions treat the trailing "///" as if it were a
> single slash. This certainly contradicts the assertion in the doc
> for squeeze-slashes that by default it behaves as if /*/*/.
>
> } With the same and path-files off, it simply behaves as if I had ls
> } /<tab>, ie it completes components in / after the four slashes.
>
> You mean path-completion off, but yes. In this case it *should* be
> happening this way because
So maybe the squeeze-slashes entry should mention something to the
effect that disabling it will only allow other options to do stuff,
but maybe nothing will. But in a less stupid way.
> } squeeze-slashes on and path-completion on behaves as the second case.
> } squeeze-slashes on and path-completion off behaves the same way.
>
> These are as expected. Once it has skipped the slashes there's nothing
> for path-completion to act upon.
Right, just wanted to be complete. :)
> } When I type ls /*/*/<tab>, all paths matching that glob are inserted
> } on the command line, this does not equal any of the above results.
>
> Red herring. Tab is expand-or-complete and as soon as you explicitly
> put in glob characters you're invoking the "expand" instead of the
> "complete".
I retried this with bindkey '^I' complete-word; setopt globcomplete.
With or without your patch, ls /*/*/cit completes to
/home/mikachu/citat and /home/mikachu/citat-private and lets me cycle
between them. Without your patch, ls ///cit completes to /tmp/citat
and /tmp/citat.private. With your patch, ls ///cit acts as /*/*/cit
did, which makes me happy. All of this of course with squeeze-slashes
off and path-completion on.
[snip explainy bits as i have nothing helpful to add]
> So try this; but there may be other places where similar things have
> been missed as this function evolved ...
>
> Index: Completion/Unix/Type/_path_files
> ===================================================================
> RCS file: /extra/cvsroot/zsh/zsh-4.0/Completion/Unix/Type/_path_files,v
> retrieving revision 1.23
> diff -u -r1.23 _path_files
> --- Completion/Unix/Type/_path_files 6 May 2011 15:29:05 -0000 1.23
> +++ Completion/Unix/Type/_path_files 14 May 2011 05:53:20 -0000
> @@ -574,7 +574,7 @@
> # slash be added.
>
> tmp1=( ${tmp1//(#b)([][()|*?^#~<>\\=])/\\${match[1]}} )
> - tmp2="${(M)tpre##((.|..|)/)##}"
> + tmp2="${(M)tpre##${~skips}}"
> if [[ -n "$tmp2" ]]; then
> skipped="/$tmp2"
> tpre="${tpre#$tmp2}"
This seems to work great in my zsh -f. My next project is working out
why none of this helps with my zshrc loaded :). Thanks.
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author