Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: completion of dates
Bart wrote:
> Are there a lot of cases where _path_files could be replaced by _files?
Plenty. Not much fun to go through checking them, though.
> Maybe the way to go is to handle glob qualifiers in BOTH places, and
> not call down into _path_files from _files while "inside" the quals?
That seems like a good plan.
A straight cut-and-paste from _path_files seems to work. Looking at the
copied lines, I'm inclined to think that it should use _alternative
to call both _globflags and _globquals with _globflags checking the
prefix-needed style. Directly completing a prefix as, e.g. \#:introduce\
glob\ flag is perhaps useful, however.
Oliver
diff --git a/Completion/Unix/Type/_files b/Completion/Unix/Type/_files
index e628cb3..4243ef7 100644
--- a/Completion/Unix/Type/_files
+++ b/Completion/Unix/Type/_files
@@ -1,6 +1,24 @@
#compdef -redirect-,-default-,-default-
-local opts tmp glob pat pats expl tag i def descr end ign ret=1 match tried
+local -a match mbegin mend
+
+# Look for glob qualifiers. This is duplicated from _path_files because
+# we don't want to complete them multiple times (for each file pattern).
+if _have_glob_qual $PREFIX; then
+ local ret=1
+ compset -p ${#match[1]}
+ if [[ $_comp_caller_options[extendedglob] == on ]] && compset -P '\#'; then
+ _globflags && ret=0
+ else
+ if [[ $_comp_caller_options[extendedglob] == on ]]; then
+ _describe -t globflags "glob flag" '(\#:introduce\ glob\ flag)' -Q -S '' && ret=0
+ fi
+ _globquals && ret=0
+ fi
+ return ret
+fi
+
+local opts tmp glob pat pats expl tag i def descr end ign ret=1 tried
local type sdef ignvars ignvar prepath oprefix rfiles rfile
zparseopts -a opts \
Messages sorted by:
Reverse Date,
Date,
Thread,
Author