Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: bug in accept-exact-dirs style



On Thu, 29 Jan 2009 08:20:25 -0800
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> 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@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070



Messages sorted by: Reverse Date, Date, Thread, Author