summary refs log tree commit diff
path: root/Completion/Base
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2014-03-03 12:08:45 +0100
committerOliver Kiddle <opk@zsh.org>2014-03-03 12:08:45 +0100
commit1f290a3e8277347a782a7766948aab47c10120c8 (patch)
treeb3d7fcacddcc49416d33214d6bf6cd9959deae98 /Completion/Base
parentb5fcc04f0e29ff00cb72b0e5c0bc9976c1c5eb33 (diff)
downloadzsh-1f290a3e8277347a782a7766948aab47c10120c8.tar.gz
zsh-1f290a3e8277347a782a7766948aab47c10120c8.tar.xz
zsh-1f290a3e8277347a782a7766948aab47c10120c8.zip
32439: add new show-ambiguity style
Diffstat (limited to 'Completion/Base')
-rw-r--r--Completion/Base/Core/_main_complete8
1 files changed, 8 insertions, 0 deletions
diff --git a/Completion/Base/Core/_main_complete b/Completion/Base/Core/_main_complete
index 8dd781dbb..e881ea6a1 100644
--- a/Completion/Base/Core/_main_complete
+++ b/Completion/Base/Core/_main_complete
@@ -334,6 +334,14 @@ elif [[ nm -eq 0 && -z "$_comp_mesg" &&
   compadd -x "$mesg"
 fi
 
+if zstyle -s ":completion:${curcontext}:" show-ambiguity tmp; then
+  local prefix=${${compstate[unambiguous]}[1,${compstate[unambiguous_cursor]}-1]}
+  local toquote='[=\(\)\|~^?*[\]#<>]'
+  [[ $tmp = (yes|true|on) ]] && tmp=4
+  [[ -n $prefix ]] &&
+    _comp_colors+=( "=(#i)${prefix[1,-2]//?/(}${prefix[1,-2]//(#m)?/${MATCH/$~toquote/\\$MATCH}|)}${prefix[-1]//(#m)$~toquote/\\$MATCH}(#b)(?|)*==$tmp" )
+fi
+
 [[ "$_comp_force_list" = always ||
    ( "$_comp_force_list" = ?*  && nm -ge _comp_force_list ) ]] &&
     compstate[list]="${compstate[list]//messages} force"