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

[PATCH] removing all '-g' from glob in _files



Looks like we should remove all '-g' options from "glob" in _files.

With the old _files, we have this result:

% ls
a.c a.h a.sh
% compdef '_files -g "*.h" -g "*.c" -g "*.sh"' foo
% foo <tab>	# only completes "a.h"

With the new _files, the <tab> will completes all three files here.
---
 Completion/Unix/Type/_files |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Completion/Unix/Type/_files b/Completion/Unix/Type/_files
index 0a27158..0f6fcd6 100644
--- a/Completion/Unix/Type/_files
+++ b/Completion/Unix/Type/_files
@@ -8,7 +8,7 @@ zparseopts -a opts \
 
 type="${(@j::M)${(@)tmp#-}#?}"
 if (( $tmp[(I)-g*] )); then
-  glob="${${${${(@M)tmp:#-g*}#-g}##[[:blank:]]#}%%[[:blank:]]#}"
+  glob="${${${(@)${(@M)tmp:#-g*}#-g}##[[:blank:]]#}%%[[:blank:]]#}"
   [[ "$glob" = *[^\\][[:blank:]]* ]] &&
       glob="{${glob//(#b)([^\\])[[:blank:]]##/${match[1]},}}"
 
-- 
1.7.7.6



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