summaryrefslogtreecommitdiffstats
path: root/Completion/Core
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>2000-03-24 12:35:07 +0000
committerTanaka Akira <akr@users.sourceforge.net>2000-03-24 12:35:07 +0000
commita2876b6db3e25ab7c5f7df10806d6f0b45b89514 (patch)
tree9b88c88737985c50b206eae2c239ffb7517862a7 /Completion/Core
parentzsh-workers/10226 (diff)
downloadzsh-a2876b6db3e25ab7c5f7df10806d6f0b45b89514.tar
zsh-a2876b6db3e25ab7c5f7df10806d6f0b45b89514.tar.gz
zsh-a2876b6db3e25ab7c5f7df10806d6f0b45b89514.tar.bz2
zsh-a2876b6db3e25ab7c5f7df10806d6f0b45b89514.tar.lz
zsh-a2876b6db3e25ab7c5f7df10806d6f0b45b89514.tar.xz
zsh-a2876b6db3e25ab7c5f7df10806d6f0b45b89514.tar.zst
zsh-a2876b6db3e25ab7c5f7df10806d6f0b45b89514.zip
zsh-workers/10230
Diffstat (limited to 'Completion/Core')
-rw-r--r--Completion/Core/_description5
-rw-r--r--Completion/Core/_ignored32
-rw-r--r--Completion/Core/_main_complete36
-rw-r--r--Completion/Core/_path_files7
-rw-r--r--Completion/Core/_prefix2
-rw-r--r--Completion/Core/_setup2
6 files changed, 48 insertions, 36 deletions
diff --git a/Completion/Core/_description b/Completion/Core/_description
index 6326d1f03..7db47228b 100644
--- a/Completion/Core/_description
+++ b/Completion/Core/_description
@@ -29,8 +29,9 @@ zstyle -s ":completion:${curcontext}:$1" matcher match &&
opts=($opts -M "${(q)match}")
[[ -n "$_matcher" ]] && opts=($opts -M "${(q)_matcher}")
-if zstyle -a ":completion:${curcontext}:$1" ignored-patterns _comp_ignore; then
- opts=( $opts -F _comp_ignore)
+if [[ -z "$_comp_no_ignore" ]] &&
+ zstyle -a ":completion:${curcontext}:$1" ignored-patterns _comp_ignore; then
+ opts=( $opts -F _comp_ignore )
else
_comp_ignore=()
fi
diff --git a/Completion/Core/_ignored b/Completion/Core/_ignored
new file mode 100644
index 000000000..69a5244cc
--- /dev/null
+++ b/Completion/Core/_ignored
@@ -0,0 +1,32 @@
+#autoload
+
+# Use ignored matches.
+
+(( $compstate[ignored] )) || return 1
+
+local curcontext="${curcontext/:[^:]#:/:ignored-${(M)#_completers[1,_completer_num]:#_ignored}:}"
+local comp i _comp_no_ignore=yes tmp expl
+
+zstyle -a ":completion:${curcontext}:" completer comp ||
+ comp=( "${(@)_completers[1,_completer_num-1][(R)_ignored,-1]}" )
+
+for i in "$comp[@]"; do
+ if [[ "$i" != _ignored ]] && "$i"; then
+ if zstyle -s ":completion:${curcontext}:" single-ignored tmp &&
+ [[ $compstate[old_list] != shown && $compstate[nmatches] -eq 1 ]]; then
+ case "$tmp" in
+ show) compstate[insert]='' compstate[list]='list force' tmp='' ;;
+ menu)
+ compstate[insert]=menu
+ _description original expl original
+ compadd "$expl[@]" -S '' - "$PREFIX$SUFFIX"
+ ;;
+ *) tmp='' ;;
+ esac
+ fi
+
+ return 0
+ fi
+done
+
+return 1
diff --git a/Completion/Core/_main_complete b/Completion/Core/_main_complete
index 244f06b7e..49e66cba7 100644
--- a/Completion/Core/_main_complete
+++ b/Completion/Core/_main_complete
@@ -19,7 +19,7 @@
setopt localoptions nullglob rcexpandparam extendedglob
unsetopt markdirs globsubst shwordsplit nounset ksharrays
-local ctxt func funcs ret=1 tmp _compskip format _comp_ignore \
+local func funcs ret=1 tmp _compskip format _comp_ignore \
_completers _completer _completer_num curtag \
_matchers _matcher _matcher_num _comp_tags \
context state line opt_args val_args curcontext="$curcontext" \
@@ -61,7 +61,8 @@ _last_menu_style=()
# Get the names of the completers to use in the positional parameters.
-(( $# )) || zstyle -a ":completion:${curcontext}:" completer argv || set _complete
+(( $# )) || zstyle -a ":completion:${curcontext}:" completer argv ||
+ set _complete
# And now just call the completer functions defined.
@@ -77,14 +78,8 @@ for func in "$funcs[@]"; do
done
for _completer; do
- ctxt=":completion:${curcontext/::/:${_completer[2,-1]}-${(M)#_completers[1,_completer_num]:#$_completer}:}:"
- if zstyle -t "$ctxt" prefer-ignored && (( $compstate[alternate_nmatches] )); then
- ret=0
- break;
- fi
-
- zstyle -a "$ctxt" matcher-list _matchers ||
+ zstyle -a ":completion:${curcontext/::/:${_completer[2,-1]}-${(M)#_completers[1,_completer_num]:#$_completer}:}:" matcher-list _matchers ||
_matchers=( '' )
_matcher_num=1
@@ -98,26 +93,9 @@ for _completer; do
(( _completer_num++ ))
done
-if zstyle -s ":completion:${curcontext}:" single-ignored tmp &&
- [[ $compstate[old_list] != shown &&
- $compstate[alternate_nmatches] = 1 ]]; then
- case "$tmp" in
- show) compstate[insert]='' compstate[list]='list force' tmp='' ;;
- menu)
- local expl
-
- compstate[insert]='menu'
- _description original expl original
- compadd "$expl[@]" -a -S '' - "$PREFIX$SUFFIX"
- ;;
- *) tmp='' ;;
- esac
-fi
-
if [[ -n "$tmp" || $compstate[old_list] = keep ||
- $compstate[nmatches]+$compstate[alternate_nmatches] -gt 1 ]]; then
- [[ _last_nmatches -ge 0 &&
- _last_nmatches -ne $compstate[nmatches]+$compstate[alternate_nmatches] ]] &&
+ $compstate[nmatches] -gt 1 ]]; then
+ [[ _last_nmatches -ge 0 && _last_nmatches -ne $compstate[nmatches] ]] &&
_menu_style=( "$_last_menu_style[@]" "$_menu_style[@]" )
if [[ "$compstate[insert]" = "$_saved_insert" ]]; then
@@ -170,7 +148,7 @@ if [[ -n "$tmp" || $compstate[old_list] = keep ||
fi
fi
fi
-elif [[ $compstate[nmatches]+$compstate[alternate_nmatches] -eq 0 &&
+elif [[ $compstate[nmatches] -eq 0 &&
$#_lastdescr -ne 0 && $compstate[old_list] != keep ]] &&
zstyle -s ":completion:${curcontext}:warnings" format format; then
diff --git a/Completion/Core/_path_files b/Completion/Core/_path_files
index d5feaa540..11445c204 100644
--- a/Completion/Core/_path_files
+++ b/Completion/Core/_path_files
@@ -142,8 +142,9 @@ eorig="$orig"
# If given no `-F' option, we may want to use $fignore, turned into patterns.
-[[ $#ignore -eq 0 && ( -z $gopt || "$pats" = \ #\*\ # ) && -n $FIGNORE ]] &&
- ignore=( "?*${^fignore[@]}" )
+[[ -z "$_comp_no_ignore" && $#ignore -eq 0 &&
+ ( -z $gopt || "$pats" = \ #\*\ # ) && -n $FIGNORE ]] &&
+ ignore=( "?*${^fignore[@]}" )
if (( $#ignore )); then
_comp_ignore=( "$_comp_ignore[@]" "$ignore[@]" )
@@ -350,7 +351,7 @@ for prepath in "$prepaths[@]"; do
continue 2
fi
- if [[ "$tpre$tsuf" != */* && $#tmp1 -ne 0 ]] &&
+ if [[ -z "$_comp_no_ignore" && "$tpre$tsuf" != */* && $#tmp1 -ne 0 ]] &&
zstyle -s ":completion:${curcontext}:files" ignore-parents rem &&
[[ ( "$rem" != *dir* || "$pats" = '*(-/)' ) &&
( "$rem" != *..* || "$tmp1" = *../* ) ]]; then
diff --git a/Completion/Core/_prefix b/Completion/Core/_prefix
index ed95140bd..32ffaea2f 100644
--- a/Completion/Core/_prefix
+++ b/Completion/Core/_prefix
@@ -7,7 +7,7 @@
local curcontext="${curcontext/:[^:]#:/:prefix-${(M)#_completers[1,_completer_num]:#_prefix}:}" comp i
zstyle -a ":completion:${curcontext}:" completer comp ||
- comp=( "${(@)_completers[1,_completer_num][(R)_prefix,-1]}" )
+ comp=( "${(@)_completers[1,_completer_num-1][(R)_prefix,-1]}" )
if zstyle -t ":completion:${curcontext}:" add-space; then
ISUFFIX=" $SUFFIX"
diff --git a/Completion/Core/_setup b/Completion/Core/_setup
index 0b9e5d0a9..ed7307e69 100644
--- a/Completion/Core/_setup
+++ b/Completion/Core/_setup
@@ -54,7 +54,7 @@ fi
_menu_style=( "$_last_menu_style[@]" "$_menu_style[@]" )
if zstyle -a ":completion:${curcontext}:$1" menu val; then
- _last_nmatches=$(( $nm + $compstate[alternate_nmatches] ))
+ _last_nmatches=$nm
_last_menu_style=( "$val[@]" )
else
_last_nmatches=-1