summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Completion/Core/_files31
-rw-r--r--Completion/User/_gdb2
-rw-r--r--Completion/User/_getconf1
-rw-r--r--Completion/User/_mh1
-rw-r--r--Completion/User/_netscape1
-rw-r--r--Completion/User/_tiff1
-rw-r--r--Completion/User/_urls7
-rw-r--r--Completion/X/_xmodmap1
-rw-r--r--Doc/Zsh/compsys.yo8
-rw-r--r--Src/Zle/computil.c16
10 files changed, 45 insertions, 24 deletions
diff --git a/Completion/Core/_files b/Completion/Core/_files
index 1755abebd..f16da0b50 100644
--- a/Completion/Core/_files
+++ b/Completion/Core/_files
@@ -1,12 +1,23 @@
#autoload
-local opts tmp glob pats expl tag i pat descr minus
+local opts tmp glob pats expl tag i pat descr end ign ret=1
zparseopts -a opts \
'/=tmp' 'f=tmp' 'g+:-=tmp' q n 1 2 P: S: r: R: W: X+: M+: F: J+: V+:
type="${(@j::M)${(@)tmp#-}#?}"
(( $tmp[(I)-g*] )) && glob="${(j: :)${(M)tmp:#-g*}#-g}"
+ign=$opts[(I)-F]
+if (( ign )); then
+ ign=( $=opts[ign+1] )
+ if [[ $ign = _comp_ignore ]]; then
+ ign=( $_comp_ignore )
+ else
+ opts[tmp+1]=_comp_ignore
+ fi
+else
+ ign=
+fi
if zstyle -a ":completion:${curcontext}:" file-patterns pats; then
[[ "$type" = */* ]] && glob="$glob *(-/)"
@@ -34,16 +45,24 @@ for tag in "${(@)${(@)pats#*[^\\]:}%%:*}"; do
if [[ i -gt 0 && "$pat" != \ # ]]; then
if [[ "$pats[i]" = *:${tag}:* ]]; then
descr="${pats[i]#*:${tag}:}"
- minus=()
else
descr=file
- minus=(-)
+ end=yes
fi
fi
- _wanted "$tag" expl "$descr" \
- _path_files -g "$pat" "$opts[@]" "$minus[@]" && return 0
-
+ if _wanted "$tag"; then
+ _comp_ignore=()
+ while _next_label "$tag" expl "$descr"; do
+ _comp_ignore=( $_comp_ignored $ign )
+ if [[ -n "$end" ]]; then
+ _path_files -g "$pat" "$opts[@]" "$expl[@]" && ret=0
+ else
+ _path_files "$expl[@]" -g "$pat" "$opts[@]" && ret=0
+ fi
+ done
+ (( ret )) || return 0
+ fi
done
return 1
diff --git a/Completion/User/_gdb b/Completion/User/_gdb
index 55e149bb7..a29eaf8b2 100644
--- a/Completion/User/_gdb
+++ b/Completion/User/_gdb
@@ -23,8 +23,8 @@ elif [[ "$PREFIX" = -* ]]; then
-directory\= -cd\= -tty\= && ret=0
compadd "$expl[@]" - -help -h -s -e -c -x -d -nx -n -quiet -q \
-batch -fullname -f -b && ret=0
- (( ret )) || return 0
done
+ (( ret )) || return 0
fi
else
prev="$words[CURRENT-1]"
diff --git a/Completion/User/_getconf b/Completion/User/_getconf
index 59e9a83bc..613632c1d 100644
--- a/Completion/User/_getconf
+++ b/Completion/User/_getconf
@@ -29,7 +29,6 @@ if [[ CURRENT -eq 2 ]]; then
_POSIX_NO_TRUNC _POSIX_VDISABLE && ret=0
compadd "$expl[@]" -S ' ' LINK_MAX MAX_CANON MAX_INPUT NAME_MAX \
PATH_MAX PIPE_BUF && ret=0
- (( ret )) || break
done
(( ret )) || return 0
done
diff --git a/Completion/User/_mh b/Completion/User/_mh
index c1f397744..724b45e5a 100644
--- a/Completion/User/_mh
+++ b/Completion/User/_mh
@@ -78,7 +78,6 @@ else
ret=0
compadd "$expl[@]" reply next cur prev first last all unseen && ret=0
_files "$expl[@]" -W folddir -g '<->' && ret=0
- (( ret )) || return 0
done
fi
return ret
diff --git a/Completion/User/_netscape b/Completion/User/_netscape
index b29c27c6c..82fa4509a 100644
--- a/Completion/User/_netscape
+++ b/Completion/User/_netscape
@@ -82,7 +82,6 @@ if [[ "$state" = "urls" ]]; then
while _next_label prefixes expl 'URL prefix'; do
compadd "$expl[@]" -S '' about: mocha: javascript: && ret=0
_urls "$@" && ret=0
- (( ret )) || return 0
done
fi
fi
diff --git a/Completion/User/_tiff b/Completion/User/_tiff
index 8fd008f0f..318c536d0 100644
--- a/Completion/User/_tiff
+++ b/Completion/User/_tiff
@@ -199,7 +199,6 @@ if [[ -n "$state" ]]; then
while _next_label values expl 'compression scheme'; do
compadd "$expl[@]" - none g4 packbits && ret=0
compadd "$expl[@]" -qS: - lzw zip jpeg g3 && ret=0
- (( ret )) || return 0
done
fi
fi
diff --git a/Completion/User/_urls b/Completion/User/_urls
index 03e8902cb..3989f2219 100644
--- a/Completion/User/_urls
+++ b/Completion/User/_urls
@@ -59,7 +59,6 @@ if ! compset -P '(#b)([-+.a-z0-9]#):' && _wanted -C argument prefixes; then
[[ -d $urls_path/bookmark ]] &&
compadd "$expl[@]" -S '' bookmark: && ret=0
compadd "$expl[@]" -S '' file: ftp:// gopher:// http:// && ret=0
- (( ret )) || return 0
done
return ret
fi
@@ -83,7 +82,6 @@ case "$scheme" in
elif [[ -z "$PREFIX" ]]; then
compadd "$expl[@]" -S '/' -r '/' - "${PWD%/}" && ret=0
fi
- (( ret )) || return 0
done
return ret
fi
@@ -100,7 +98,6 @@ case "$scheme" in
_path_files -W "$urls_path/$scheme" "$expl[@]" -S '' -g '*(^/)' &&
ret=0
_path_files -W "$urls_path/$scheme" -S/ -r '/' -/ && ret=0
- (( ret )) || return 0
done
fi
fi
@@ -116,7 +113,6 @@ if ! compset -P '(#b)([^/]#)/' && _wanted hosts; then
(( $#uhosts )) || _hosts -S/ && ret=0
[[ "$scheme" = http ]] && uhosts=($uhosts $localhttp_servername)
compadd "$expl[@]" -S/ - $uhosts && ret=0
- (( ret )) || return 0
done
return ret
fi
@@ -136,20 +132,17 @@ if [[ "$localhttp_servername" = "$host" ]]; then
while _next_label files expl 'local file'; do
_path_files "$expl[@]" -W ~$user/$localhttp_userdir -g '*(^/)' && ret=0
_path_files "$expl[@]" -W ~$user/$localhttp_userdir -S/ -r '/' -/ && ret=0
- (( ret )) || return 0
done
else
while _next_label files expl 'local file'; do
_path_files "$expl[@]" -W $localhttp_documentroot -g '*(^/)' && ret=0
_path_files "$expl[@]" -W $localhttp_documentroot -S/ -r '/' -/ && ret=0
- (( ret )) || return 0
done
fi
else
while _next_label files expl 'local file'; do
_path_files "$expl[@]" -W $urls_path/$scheme/$host -g '*(^/)' && ret=0
_path_files "$expl[@]" -W $urls_path/$scheme/$host -S/ -r '/' -/ && ret=0
- (( ret )) || return 0
done
fi
return $ret
diff --git a/Completion/X/_xmodmap b/Completion/X/_xmodmap
index 1cd461d4c..6595d5adf 100644
--- a/Completion/X/_xmodmap
+++ b/Completion/X/_xmodmap
@@ -86,7 +86,6 @@ if [[ -n "$state" ]]; then
while _next_label commands expl command; do
compadd "$expl[@]" -S ' ' keycode keysym clear add remove && ret=0
compadd "$expl[@]" -S ' = ' pointer && ret=0
- (( ret )) || return 0
done
fi
fi
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index cf953d103..b7bab6c6d 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -1651,10 +1651,10 @@ will be considered.
Of course, this can also be used to split the matches for one tag into
different groups. For example:
-example(zstyle ':completion:*:options' tag-order \
- 'options:-long:long options
- options:-short:short options
- options:-single-letter:single letter options'
+example(zstyle ':completion:*' tag-order \
+ 'options:-long:long\ options
+ options:-short:short\ options
+ options:-single-letter:single\ letter\ options'
zstyle ':completion:*:options-long' ignored-patterns '[-+](|-|[^-]*)'
zstyle ':completion:*:options-short' ignored-patterns '--*' '[-+]?'
diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c
index a844ee1ef..828fe36d0 100644
--- a/Src/Zle/computil.c
+++ b/Src/Zle/computil.c
@@ -2405,7 +2405,7 @@ bin_comptry(char *nam, char **args, char *ops, int func)
while (*s) {
while (*s && iblank(*s))
s++;
- for (p = q = s, c = NULL; *s && !iblank(*s); s++) {
+ for (p = q = s, c = NULL; *s && !inblank(*s); s++) {
if (!c && *s == ':')
c = p;
if (*s == '\\' && s[1])
@@ -2423,12 +2423,26 @@ bin_comptry(char *nam, char **args, char *ops, int func)
tokenize(qq);
if (haswilds(qq)) {
Patprog prog;
+ LinkNode node;
if ((prog = patcompile(qq, PAT_STATIC, NULL))) {
char **a, *n;
int l = (c ? strlen(c + 1) + 2 : 1), al;
for (a = all; *a; a++) {
+ for (node = firstnode(list); node;
+ incnode(node)) {
+ char *as, *ls;
+
+ for (as = *a, ls = (char *) getdata(node);
+ *as && *ls && *ls != ':'; as++, ls++)
+ if (*as != *ls)
+ break;
+ if (!*as && (!*ls || *ls == ':'))
+ break;
+ }
+ if (node)
+ continue;
if (pattry(prog, *a)) {
n = (char *) zhalloc((al = strlen(*a)) + l);
strcpy(n, *a);