Skip to content

Commit

Permalink
32439: add new show-ambiguity style
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver Kiddle committed Mar 3, 2014
1 parent b5fcc04 commit 1f290a3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
2014-03-03 Oliver Kiddle <opk@zsh.org>

* 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

Expand Down
8 changes: 8 additions & 0 deletions Completion/Base/Core/_main_complete
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
9 changes: 9 additions & 0 deletions Doc/Zsh/compsys.yo
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1f290a3

Please sign in to comment.