* bug in accept-exact-dirs style
@ 2009-01-27 23:54 Greg Klanderman
2009-01-29 16:20 ` Bart Schaefer
0 siblings, 1 reply; 3+ messages in thread
From: Greg Klanderman @ 2009-01-27 23:54 UTC (permalink / raw)
To: Zsh list
[~] greg@lwm| zsh -f
lwm% mkdir foo
lwm% touch foo/bar
lwm% touch foo/baz
lwm% autoload -U compinit
lwm% compinit
lwm% zstyle ':completion:*' accept-exact-dirs yes
Now try completing each of the following:
ls foo/ # OK
ls ~/foo/ # doesn't work - no completions
ls /home/greg/foo/ # OK
ls $HOME/foo/ # doesn't work - no completions
Now,
lwm% cd /tmp
and try those again:
ls ~/foo/ # OK
ls /home/greg/foo/ # OK
ls $HOME/foo/ # OK
thanks,
Greg
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: bug in accept-exact-dirs style
2009-01-27 23:54 bug in accept-exact-dirs style Greg Klanderman
@ 2009-01-29 16:20 ` Bart Schaefer
2009-01-29 17:51 ` Peter Stephenson
0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2009-01-29 16:20 UTC (permalink / raw)
To: Zsh list
On Jan 27, 6:54pm, Greg Klanderman wrote:
}
} [~] greg@lwm| zsh -f
} lwm% mkdir foo
} lwm% touch foo/bar
} lwm% touch foo/baz
} lwm% autoload -U compinit
} lwm% compinit
} lwm% zstyle ':completion:*' accept-exact-dirs yes
}
} Now try completing each of the following:
}
} ls foo/ # OK
} ls ~/foo/ # doesn't work - no completions
} ls /home/greg/foo/ # OK
} ls $HOME/foo/ # doesn't work - no completions
This isn't directly related to accept-exact-dirs ... a prefix that
needs expansion is removed by _path_files in the section between the
comments
# Now let's have a closer look at the string to complete.
and
# Now we generate the matches. First we loop over all prefix paths given
# with the `-W' option.
The result after removing the prefix eventually ends up in $tmp1, so
when that is a string that will still pass the -d test in this loop:
while true; do
if [[ -d $donepath$tmp1 ]]; then
donepath=$donepath$tmp1/
pre=$tpre
break
elif [[ $tmp1 = (#b)(*)/([^/]#) ]]; then
tmp1=$match[1]
tpre=$match[2]/$tpre
else
break
fi
done
Then the code is fooled into thinking that the suffix is part of the
prefix, and on line 585 the PREFIX string is rebuilt in the wrong order,
becoming "tmp/~/" instead of "~/tmp/".
At that point I get lost, and I've already spent more time than I should
have looking at it. PWS? Anyone?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: bug in accept-exact-dirs style
2009-01-29 16:20 ` Bart Schaefer
@ 2009-01-29 17:51 ` Peter Stephenson
0 siblings, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2009-01-29 17:51 UTC (permalink / raw)
To: Zsh list
On Thu, 29 Jan 2009 08:20:25 -0800
Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Jan 27, 6:54pm, Greg Klanderman wrote:
> }
> } [~] greg@lwm| zsh -f
> } lwm% mkdir foo
> } lwm% touch foo/bar
> } lwm% touch foo/baz
> } lwm% autoload -U compinit
> } lwm% compinit
> } lwm% zstyle ':completion:*' accept-exact-dirs yes
> }
> } Now try completing each of the following:
> }
> } ls foo/ # OK
> } ls ~/foo/ # doesn't work - no completions
> } ls /home/greg/foo/ # OK
> } ls $HOME/foo/ # doesn't work - no completions
>
> Then the code is fooled into thinking that the suffix is part of the
> prefix, and on line 585 the PREFIX string is rebuilt in the wrong order,
> becoming "tmp/~/" instead of "~/tmp/".
Ah, yes, The bug is at this point, I think. The ordering appears to be
OK for other uses of donepath (though, in _path_files, it's hard
to be sure). Thanks for looking.
Index: Completion/Unix/Type/_path_files
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_path_files,v
retrieving revision 1.41
diff -u -r1.41 _path_files
--- Completion/Unix/Type/_path_files 10 Nov 2008 15:28:41 -0000 1.41
+++ Completion/Unix/Type/_path_files 29 Jan 2009 17:49:41 -0000
@@ -578,11 +578,11 @@
if [[ "$tpre" = */* ]]; then
tmp2="${cpre}${tpre%%/*}"
- PREFIX="${donepath}${linepath}${tmp2}"
+ PREFIX="${linepath}${donepath}${tmp2}"
SUFFIX="/${tpre#*/}${tsuf#*/}"
else
tmp2="${cpre}${tpre}"
- PREFIX="${donepath}${linepath}${tmp2}"
+ PREFIX="${linepath}${donepath}${tmp2}"
SUFFIX="${tsuf}"
fi
--
Peter Stephenson <pws@csr.com> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-01-29 17:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-27 23:54 bug in accept-exact-dirs style Greg Klanderman
2009-01-29 16:20 ` Bart Schaefer
2009-01-29 17:51 ` Peter Stephenson
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).