about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2000-06-16 07:38:59 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2000-06-16 07:38:59 +0000
commitae2b3953df36a9f95e268906b736b407a2739784 (patch)
treef445c457edf6960aa21646d6d3a7ffa7b8100268 /Completion
parent0b892d4492257bab203435afba1aefe791a9f445 (diff)
downloadzsh-ae2b3953df36a9f95e268906b736b407a2739784.tar.gz
zsh-ae2b3953df36a9f95e268906b736b407a2739784.tar.xz
zsh-ae2b3953df36a9f95e268906b736b407a2739784.zip
enhance ignore-line to ignore all/current/other word(s) (11938)
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Core/_description20
1 files changed, 12 insertions, 8 deletions
diff --git a/Completion/Core/_description b/Completion/Core/_description
index 557dd6ca0..700f39575 100644
--- a/Completion/Core/_description
+++ b/Completion/Core/_description
@@ -30,15 +30,19 @@ zstyle -s ":completion:${curcontext}:$1" matcher match &&
 [[ -n "$_matcher" ]] && opts=($opts -M "$_matcher")
 
 if [[ -z "$_comp_no_ignore" ]]; then
-  if zstyle -a ":completion:${curcontext}:$1" ignored-patterns _comp_ignore; then
-    opts=( $opts -F _comp_ignore )
-    zstyle -t ":completion:${curcontext}:$1" ignore-line &&
-        _comp_ignore=( "$_comp_ignore[@]" "$words[@]" )
-  elif zstyle -t ":completion:${curcontext}:$1" ignore-line; then
-    _comp_ignore=( "$words[@]" )
-  else
+  zstyle -a ":completion:${curcontext}:$1" ignored-patterns _comp_ignore ||
     _comp_ignore=()
-  fi
+
+  zstyle -s ":completion:${curcontext}:$1" ignore-line hidden &&
+    case "$hidden" in
+    true|yes|on|1) _comp_ignore=( "$_comp_ignore[@]" "$words[@]" );;
+    current)       _comp_ignore=( "$_comp_ignore[@]" "$words[CURRENT]" );;
+    other)         _comp_ignore=( "$_comp_ignore[@]"
+                                  "${(@)words[1,CURRENT-1]}"
+				  "${(@)words[CURRENT+1,-1]}" );;
+    esac
+
+  (( $#_comp_ignore )) && opts=( $opts -F _comp_ignore )
 else
   _comp_ignore=()
 fi