1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-01-17 10:20:55 +01:00

41563: fix completion description alignment with _regex_words

This commit is contained in:
Oliver Kiddle 2017-08-18 13:02:18 +02:00
parent 620b7d61ab
commit 9dee8e00b9
2 changed files with 15 additions and 9 deletions

View file

@ -1,5 +1,8 @@
2017-08-18 Oliver Kiddle <opk@zsh.org>
* 41563: Completion/Base/Utility/_regex_words: fix completion
description alignment with _regex_words
* 41562: Completion/BSD/Command/_rcctl: correct completed word
* 41561: Completion/Unix/Command/_dhclient: handle Free/OpenBSD

View file

@ -1,6 +1,6 @@
#autoload
local opt OPTARG
local opt OPTARG matches end
local term=$'\0'
while getopts "t:" opt; do
@ -31,19 +31,22 @@ fi
integer i
local -a wds
if [[ $term = $'\0' ]]; then
matches=":${tag}:${desc}:(( "
end="))"
else
matches=":${tag}:${desc}:_values -s ${(q)term} ${(q)desc}"
fi
for (( i = 1; i <= $#; i++ )); do
wds=(${(s.:.)argv[i]})
reply+=(/${wds[1]//\**/"[^$term]#"}"$term"/)
if [[ $term = $'\0' ]]; then
reply+=(":${tag}:${desc}:(( ${wds[1]//\*}:${wds[2]//(#m)[: \(\)]/\\$MATCH} ))")
matches+="${wds[1]//\*}${wds[2]:+\\:${wds[2]//(#m)[: \(\)]/\\$MATCH}} "
else
reply+=(":${tag}:${desc}:_values -s ${(q)term} ${(q)desc} \
${(q)${${wds[1]//\*}//(#m)[:\[\]]/\\$MATCH}}\\[${(q)${wds[2]//(#m)[:\[\]]/\\$MATCH}}\\]")
matches+=" ${(q)${${wds[1]//\*}//(#m)[:\[\]]/\\$MATCH}}\\[${(q)${wds[2]//(#m)[:\[\]]/\\$MATCH}}\\]"
fi
eval "reply+=($wds[3])"
if (( $i == $# )); then
reply+=(\))
else
reply+=(\|)
fi
reply+=(\|)
done
reply+=( /'[]'/ "${matches}${end}" \) )