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

Re: Buggy ignore-line feature on certain filenames?



On Wed, 29 Jul 2009 00:03:47 +0200
Joerg Schmalfuss <tyberion@xxxxxxxxxxxxxx> wrote:
> I think I just found a bug concerning the
> zstyle ':completion:*:*:command:*' ignore-line yes
> feature function...
> 
> I spent the whole day thinking I was doing something wrong but in the end...
> it turns out for this one not to be able to handle certain filenames..
> To be exact - if you got multiple filenames starting with a [  they wont get
> removed from the completition list.

Right, it's a quoting problem.  The -F option to compadd takes an array
of patterns, so special characters need quoting.

If you find something still doesn't work, let us know--there may be more
to it.

Index: Completion/Base/Core/_description
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Core/_description,v
retrieving revision 1.6
diff -u -r1.6 _description
--- Completion/Base/Core/_description	15 Nov 2006 16:27:15 -0000	1.6
+++ Completion/Base/Core/_description	30 Jul 2009 18:53:42 -0000
@@ -49,13 +49,14 @@
 
   zstyle -s ":completion:${curcontext}:$1" ignore-line hidden &&
     case "$hidden" in
-    true|yes|on|1) _comp_ignore=( "$_comp_ignore[@]" "$words[@]" );;
-    current)       _comp_ignore=( "$_comp_ignore[@]" "$words[CURRENT]" );;
-    current-shown) [[ "$compstate[old_list]" = *shown* ]] &&
-                       _comp_ignore=( "$_comp_ignore[@]" "$words[CURRENT]" );;
+    true|yes|on|1) _comp_ignore=( "$_comp_ignore[@]" ${(q)"${words[@]}"} );;
+    current)       _comp_ignore=( "$_comp_ignore[@]" "${(q)words[CURRENT]}" );;
+    current-shown)
+	    [[ "$compstate[old_list]" = *shown* ]] &&
+            _comp_ignore=( "$_comp_ignore[@]" "${(q)words[CURRENT]}" );;
     other)         _comp_ignore=( "$_comp_ignore[@]"
-                                  "${(@)words[1,CURRENT-1]}"
-				  "${(@)words[CURRENT+1,-1]}" );;
+                                  "${(@q)words[1,CURRENT-1]}"
+				  "${(@q)words[CURRENT+1,-1]}" );;
     esac
 
   # Ensure the ignore option is first so we can override it


-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



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