summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--Completion/Core/_description20
-rw-r--r--Doc/Zsh/compsys.yo12
3 files changed, 25 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 8bd7388d7..0d4080e3a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2000-06-16  Sven Wischnowsky  <wischnow@zsh.org>
 
+	* 11938: Completion/Core/_description, Doc/Zsh/compsys.yo: enhance
+ 	ignore-line to ignore all/current/other word(s)
+	
 	* 11937: Completion/Core/_expand, Completion/Core/_list,
  	Doc/Zsh/compsys.yo, Doc/Zsh/mod_zutil.yo, Src/Modules/zutil.c:
  	zstyle -e option; change math-styles to boolean ones; change
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
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index 48cc63db9..0c6f218e9 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -1187,9 +1187,17 @@ kindex(ignore-line, completion style)
 item(tt(ignore-line))(
 This style is tested for the tags used when generating matches.  If it
 is set to `true', then none of the words that are already on the line
-will be considered possible completions.
+will be considered possible completions.  If it is set to
+`tt(current)', the word the cursor is on will not be considered a
+possible completion and if it is set to `tt(other)' all words except
+the current one will not be considered to be a possible completion.
 
-Note that you almost certainly don't want to set this for a general
+The value `tt(current)' is a bit like the opposite of the
+tt(accept-exact). It means that only strings with missing characters
+will be completed.
+
+Note that you almost certainly don't want to set this to `true' or
+`tt(other)' for a general
 context such as `tt(:completion:*)'.  This is because it would disallow
 completion of, for example, options multiple times even if the command
 in question accepts the option more than once.