about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2002-04-04 12:05:17 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2002-04-04 12:05:17 +0000
commitc4b8482b9468af8169dd33271c954a84de6f4cad (patch)
treea6aefe8914db19647a2918f7e586b7c900992901
parent8ce654afb58e1b5fb619144e2eb12142d448976b (diff)
downloadzsh-c4b8482b9468af8169dd33271c954a84de6f4cad.tar.gz
zsh-c4b8482b9468af8169dd33271c954a84de6f4cad.tar.xz
zsh-c4b8482b9468af8169dd33271c954a84de6f4cad.zip
add original string as match (like in _approximate)
-rw-r--r--ChangeLog3
-rw-r--r--Completion/Base/Completer/_match17
2 files changed, 17 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 01473248d..10d5730aa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2002-04-04  Oliver Kiddle  <opk@zsh.org>
 
+	* 16911: Completion/Base/Completer/_match: add original string as
+	match with original style like in _approximate
+
 	* 16933; based on 16011 (Martin Ebourne) and 16906 (Bart):
 	Functions/Zle/up-line-or-beginning-search,
 	Functions/Zle/down-line-or-beginning-search:
diff --git a/Completion/Base/Completer/_match b/Completion/Base/Completer/_match
index ce2b8affe..a6aaa3f0c 100644
--- a/Completion/Base/Completer/_match
+++ b/Completion/Base/Completer/_match
@@ -22,6 +22,8 @@ tmp="${${:-$PREFIX$SUFFIX}#[~=]}"
 
 _old_match_string="$PREFIX$SUFFIX$HISTNO"
 
+_tags matches original
+
 zstyle -s ":completion:${curcontext}:" match-original orig
 zstyle -s ":completion:${curcontext}:" insert-unambiguous ins
 
@@ -61,10 +63,19 @@ if (( ! ret )); then
 #        ins=yes compstate[insert]="$ocsi" compstate[pattern_insert]="$ocspi"
   fi
 
-  [[ "$ins" = (true|yes|on|1) &&
-     $#compstate[unambiguous] -ge ${#:-${PREFIX}${SUFFIX}} ]] && 
-      compstate[pattern_insert]=unambiguous
+  if [[ "$ins" = (true|yes|on|1) &&
+      $#compstate[unambiguous] -ge ${#:-${PREFIX}${SUFFIX}} ]]
+  then 
+    compstate[pattern_insert]=unambiguous
+  elif _requested original &&
+      { [[ compstate[nmatches] -gt 1 ]] ||
+	zstyle -t ":completion:${curcontext}:" original }; then
+    local expl
+
+    _description -V original expl original
 
+    compadd "$expl[@]" -U -Q - "$PREFIX$SUFFIX"
+  fi    
 fi
 
 return ret