From b230e6d11d78271f3fc2492b51ddf8f7c109b500 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Tue, 14 Jul 2015 12:48:37 +0200 Subject: 35789: (tweaked c.f. Bart: 35791): duplicate glob qualifier handling from _path_files so it is called once and not for each file pattern --- Completion/Unix/Type/_files | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Type') diff --git a/Completion/Unix/Type/_files b/Completion/Unix/Type/_files index e628cb39e..a8ba9b3ce 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 +local ret=1 + +# 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 + 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 tried local type sdef ignvars ignvar prepath oprefix rfiles rfile zparseopts -a opts \ -- cgit 1.4.1