summaryrefslogtreecommitdiff
path: root/Completion/Base
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Base')
-rw-r--r--Completion/Base/Completer/_expand2
-rw-r--r--Completion/Base/Core/_main_complete17
-rw-r--r--Completion/Base/Core/_setup10
-rw-r--r--Completion/Base/Utility/_describe7
4 files changed, 27 insertions, 9 deletions
diff --git a/Completion/Base/Completer/_expand b/Completion/Base/Completer/_expand
index 3c76e1328..e52144cb7 100644
--- a/Completion/Base/Completer/_expand
+++ b/Completion/Base/Completer/_expand
@@ -87,7 +87,7 @@ if [[ "$force" = *s* ]] ||
setopt aliases
eval 'exp=( ${${(e)exp//\\[
-]/ }//(#b)([ \\
+]/ }//(#b)([
])/\\$match[1]} )' 2>/dev/null
setopt NO_aliases
else
diff --git a/Completion/Base/Core/_main_complete b/Completion/Base/Core/_main_complete
index 977ab49ee..9c4cfac85 100644
--- a/Completion/Base/Core/_main_complete
+++ b/Completion/Base/Core/_main_complete
@@ -36,7 +36,8 @@ local func funcs ret=1 tmp _compskip format nm call match min max i num\
_saved_list="${compstate[list]}" \
_saved_insert="${compstate[insert]}" \
_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
local -a precommands
@@ -140,11 +141,16 @@ _completer_num=1
# We assume localtraps to be in effect here ...
integer SECONDS=0
-TRAPINT TRAPQUIT() {
+TRAPINT() {
zle -M "Killed by signal in ${funcstack[2]} after ${SECONDS}s";
zle -R
return 130
}
+TRAPQUIT() {
+ zle -M "Killed by signal in ${funcstack[2]} after ${SECONDS}s";
+ zle -R
+ return 131
+}
# Call the pre-functions.
@@ -349,12 +355,11 @@ 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]}
+if [[ -n "$_ambiguous_color" ]]; then
local toquote='[=\(\)\|~^?*[\]#<>]'
- [[ $tmp = (yes|true|on) ]] && tmp=4
+ local prefix=${${compstate[unambiguous]}[1,${compstate[unambiguous_cursor]}-1]}
[[ -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
[[ "$_comp_force_list" = always ||
diff --git a/Completion/Base/Core/_setup b/Completion/Base/Core/_setup
index d85ebb885..ca975332f 100644
--- a/Completion/Base/Core/_setup
+++ b/Completion/Base/Core/_setup
@@ -9,8 +9,7 @@ if zstyle -a ":completion:${curcontext}:$1" list-colors val; then
if [[ "$1" = default ]]; then
_comp_colors=( "$val[@]" )
else
- _comp_colors=( "$_comp_colors[@]"
- "(${2})${(@)^val:#(|\(*\)*)}" "${(M@)val:#\(*\)*}" )
+ _comp_colors+=( "(${2})${(@)^val:#(|\(*\)*)}" "${(M@)val:#\(*\)*}" )
fi
# Here is the problem mentioned in _main_complete.
@@ -23,6 +22,13 @@ elif [[ "$1" = default ]]; then
unset ZLS_COLORS ZLS_COLOURS
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
compstate[list]="${compstate[list]} packed"
elif [[ $? -eq 1 ]]; then
diff --git a/Completion/Base/Utility/_describe b/Completion/Base/Utility/_describe
index ab7200517..76ab1d995 100644
--- a/Completion/Base/Utility/_describe
+++ b/Completion/Base/Utility/_describe
@@ -1,5 +1,12 @@
#autoload
+# ### Note: Calling this function twice during one completion operation, such
+# ### that in each call there exists a pair of items having the same description
+# ### as each other, and the two calls specify the same $_type, currently leads
+# ### to garbled output; see workers/35229 (May 2015) and its thread (which also
+# ### discusses at least two other issues, that may or may not be related to
+# ### this one).
+
# This can be used to add options or values with descriptions as matches.
local _opt _expl _tmpm _tmpd _mlen _noprefix