mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-23 04:51:12 +02:00
35163: move "show-ambiguity" style to _setup so that more precise context can be applied
This commit is contained in:
parent
229bc3cc74
commit
a253ada08b
3 changed files with 17 additions and 7 deletions
|
@ -4,6 +4,10 @@
|
||||||
Src/builtin.c: extend "fc -I" to cover listing of "internal"
|
Src/builtin.c: extend "fc -I" to cover listing of "internal"
|
||||||
history events only
|
history events only
|
||||||
|
|
||||||
|
* 35163: Completion/Base/Core/_main_complete,
|
||||||
|
Completion/Base/Core/_setup: move "show-ambiguity" style to _setup
|
||||||
|
so that more precise context can be applied
|
||||||
|
|
||||||
2015-06-05 Peter Stephenson <p.stephenson@samsung.com>
|
2015-06-05 Peter Stephenson <p.stephenson@samsung.com>
|
||||||
|
|
||||||
* 35386: Doc/Zsh/builtins.yo, Doc/Zsh/contrib.yo,
|
* 35386: Doc/Zsh/builtins.yo, Doc/Zsh/contrib.yo,
|
||||||
|
|
|
@ -36,7 +36,8 @@ local func funcs ret=1 tmp _compskip format nm call match min max i num\
|
||||||
_saved_list="${compstate[list]}" \
|
_saved_list="${compstate[list]}" \
|
||||||
_saved_insert="${compstate[insert]}" \
|
_saved_insert="${compstate[insert]}" \
|
||||||
_saved_colors="$ZLS_COLORS" \
|
_saved_colors="$ZLS_COLORS" \
|
||||||
_saved_colors_set=${+ZLS_COLORS}
|
_saved_colors_set=${+ZLS_COLORS} \
|
||||||
|
_ambiguous_color=''
|
||||||
|
|
||||||
# _precommand sets this to indicate we are following a precommand modifier
|
# _precommand sets this to indicate we are following a precommand modifier
|
||||||
local -a precommands
|
local -a precommands
|
||||||
|
@ -349,12 +350,11 @@ elif [[ nm -eq 0 && -z "$_comp_mesg" &&
|
||||||
compadd -x "$mesg"
|
compadd -x "$mesg"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if zstyle -s ":completion:${curcontext}:" show-ambiguity tmp; then
|
if [[ -n "$_ambiguous_color" ]]; then
|
||||||
local prefix=${${compstate[unambiguous]}[1,${compstate[unambiguous_cursor]}-1]}
|
|
||||||
local toquote='[=\(\)\|~^?*[\]#<>]'
|
local toquote='[=\(\)\|~^?*[\]#<>]'
|
||||||
[[ $tmp = (yes|true|on) ]] && tmp=4
|
local prefix=${${compstate[unambiguous]}[1,${compstate[unambiguous_cursor]}-1]}
|
||||||
[[ -n $prefix ]] &&
|
[[ -n $prefix ]] &&
|
||||||
_comp_colors+=( "=(#i)${prefix[1,-2]//?/(}${prefix[1,-2]//(#m)?/${MATCH/$~toquote/\\$MATCH}|)}${prefix[-1]//(#m)$~toquote/\\$MATCH}(#b)(?|)*==$tmp" )
|
_comp_colors+=( "=(#i)${prefix[1,-2]//?/(}${prefix[1,-2]//(#m)?/${MATCH/$~toquote/\\$MATCH}|)}${prefix[-1]//(#m)$~toquote/\\$MATCH}(#b)(?|)*==$_ambiguous_color" )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ "$_comp_force_list" = always ||
|
[[ "$_comp_force_list" = always ||
|
||||||
|
|
|
@ -9,8 +9,7 @@ if zstyle -a ":completion:${curcontext}:$1" list-colors val; then
|
||||||
if [[ "$1" = default ]]; then
|
if [[ "$1" = default ]]; then
|
||||||
_comp_colors=( "$val[@]" )
|
_comp_colors=( "$val[@]" )
|
||||||
else
|
else
|
||||||
_comp_colors=( "$_comp_colors[@]"
|
_comp_colors+=( "(${2})${(@)^val:#(|\(*\)*)}" "${(M@)val:#\(*\)*}" )
|
||||||
"(${2})${(@)^val:#(|\(*\)*)}" "${(M@)val:#\(*\)*}" )
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Here is the problem mentioned in _main_complete.
|
# Here is the problem mentioned in _main_complete.
|
||||||
|
@ -23,6 +22,13 @@ elif [[ "$1" = default ]]; then
|
||||||
unset ZLS_COLORS ZLS_COLOURS
|
unset ZLS_COLORS ZLS_COLOURS
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# What we'd like is to test that the show-ambiguity style pattern is more
|
||||||
|
# specific than the list-colors style pattern, but that's not possible yet
|
||||||
|
if zstyle -s ":completion:${curcontext}:$1" show-ambiguity val; then
|
||||||
|
zmodload -i zsh/complist
|
||||||
|
[[ $val = (yes|true|on) ]] && _ambiguous_color=4 || _ambiguous_color=$val
|
||||||
|
fi
|
||||||
|
|
||||||
if zstyle -t ":completion:${curcontext}:$1" list-packed; then
|
if zstyle -t ":completion:${curcontext}:$1" list-packed; then
|
||||||
compstate[list]="${compstate[list]} packed"
|
compstate[list]="${compstate[list]} packed"
|
||||||
elif [[ $? -eq 1 ]]; then
|
elif [[ $? -eq 1 ]]; then
|
||||||
|
|
Loading…
Reference in a new issue