From 1f290a3e8277347a782a7766948aab47c10120c8 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Mon, 3 Mar 2014 12:08:45 +0100 Subject: 32439: add new show-ambiguity style --- ChangeLog | 3 +++ Completion/Base/Core/_main_complete | 8 ++++++++ Doc/Zsh/compsys.yo | 9 +++++++++ 3 files changed, 20 insertions(+) diff --git a/ChangeLog b/ChangeLog index d35f5b049..cf4e223d3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2014-03-03 Oliver Kiddle + * 32439 (with Yuri D'Elia): Completion/Base/Core/_main_complete: + add new show-ambiguity style + * 32436: Src/Zle/complist.c: allow = to be used in ZLS_COLORS patterns if it is quoted or inside parentheses 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" diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo index c304461e2..5a5e61996 100644 --- a/Doc/Zsh/compsys.yo +++ b/Doc/Zsh/compsys.yo @@ -2440,6 +2440,15 @@ completing words for the dict command. It allows words from different dictionary databases to be added separately. The default for this style is `false'. ) +kindex(show-ambiguity, completion style) +item(tt(show-ambiguity))( +If the tt(zsh/complist) module is loaded, this style can be used to +highlight the first ambiguous character in completion lists. The +value is either a color indication such as those supported by the +tt(list-colors) style or, with a value of tt(true), a default of +underlining is selected. The highlighting is only applied if the +completion display strings correspond to the actual matches. +) kindex(show-completer, completion style) item(tt(show-completer))( Tested whenever a new completer is tried. If it is true, the completion -- cgit 1.4.1