mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-03 10:21:46 +02:00
16397: use nul instead of colon to avoid problems with _value: functions
This commit is contained in:
parent
96de4d0740
commit
ae0bba2bfc
2 changed files with 19 additions and 21 deletions
|
@ -1,5 +1,8 @@
|
||||||
2002-01-03 Oliver Kiddle <opk@zsh.org>
|
2002-01-03 Oliver Kiddle <opk@zsh.org>
|
||||||
|
|
||||||
|
* 16397: Completion/Base/Widget/_complete_help: use nul as separator
|
||||||
|
instead of colon to avoid problems with _value:<param> functions
|
||||||
|
|
||||||
* 16396: Completion/Unix/Command/_chown: fix argument handling bugs
|
* 16396: Completion/Unix/Command/_chown: fix argument handling bugs
|
||||||
|
|
||||||
2002-01-03 Clint Adams <clint@zsh.org>
|
2002-01-03 Clint Adams <clint@zsh.org>
|
||||||
|
|
|
@ -14,8 +14,8 @@ _complete_help() {
|
||||||
|
|
||||||
if [[ "$help_sfuncs[$2]" != *${_f}* ||
|
if [[ "$help_sfuncs[$2]" != *${_f}* ||
|
||||||
"$help_styles[${2}${_f}]" != *${3}* ]]; then
|
"$help_styles[${2}${_f}]" != *${3}* ]]; then
|
||||||
[[ "$help_sfuncs[$2]" != *${_f}* ]] &&
|
|
||||||
help_sfuncs[$2]="${help_sfuncs[$2]}:${_f}"
|
[[ "$help_sfuncs[$2]" != *${_f}* ]] && help_sfuncs[$2]+=$'\0'"${_f}"
|
||||||
local _t
|
local _t
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
@ -24,7 +24,7 @@ _complete_help() {
|
||||||
-h) _t='[assoc] ';;
|
-h) _t='[assoc] ';;
|
||||||
*) _t='[boolean]';;
|
*) _t='[boolean]';;
|
||||||
esac
|
esac
|
||||||
help_styles[${2}${_f}]="${help_styles[${2}${_f}]},${_t} ${3}:${_f}"
|
help_styles[${2}${_f}]+=",${_t} ${3}:${_f}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# No need to call the completers more than once with different match specs.
|
# No need to call the completers more than once with different match specs.
|
||||||
|
@ -43,32 +43,27 @@ _complete_help() {
|
||||||
trap - EXIT INT
|
trap - EXIT INT
|
||||||
|
|
||||||
for i in "${(@ok)help_funcs}"; do
|
for i in "${(@ok)help_funcs}"; do
|
||||||
text="${text}
|
text+=$'\n'"tags in context :completion:${i}:"
|
||||||
tags in context :completion:${i}:"
|
|
||||||
tmp=()
|
tmp=()
|
||||||
for j in "${(@s.:.)help_funcs[$i][2,-1]}"; do
|
for j in "${(@ps.\0.)help_funcs[$i][2,-1]}"; do
|
||||||
tmp=( "$tmp[@]" "${(@s.,.)help_tags[${i}${j}][2,-1]}" )
|
tmp+=( "${(@s.,.)help_tags[${i}${j}][2,-1]}" )
|
||||||
done
|
done
|
||||||
zformat -a tmp ' (' "$tmp[@]"
|
zformat -a tmp ' (' "$tmp[@]"
|
||||||
tmp=( '
|
tmp=( $'\n '${^tmp}')' )
|
||||||
'${^tmp}')' )
|
text+="${tmp}"
|
||||||
text="${text}${tmp}"
|
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ ${NUMERIC:-1} -ne 1 ]]; then
|
if [[ ${NUMERIC:-1} -ne 1 ]]; then
|
||||||
text="$text
|
text+=$'\n'
|
||||||
"
|
|
||||||
for i in "${(@ok)help_sfuncs}"; do
|
for i in "${(@ok)help_sfuncs}"; do
|
||||||
text="${text}
|
text+=$'\n'"styles in context ${i}"
|
||||||
styles in context ${i}"
|
|
||||||
tmp=()
|
tmp=()
|
||||||
for j in "${(@s.:.)help_sfuncs[$i][2,-1]}"; do
|
for j in "${(@ps.\0.)help_sfuncs[$i][2,-1]}"; do
|
||||||
tmp=( "$tmp[@]" "${(@s.,.)help_styles[${i}${j}][2,-1]}" )
|
tmp+=( "${(@s.,.)help_styles[${i}${j}][2,-1]}" )
|
||||||
done
|
done
|
||||||
zformat -a tmp ' (' "$tmp[@]"
|
zformat -a tmp ' (' "$tmp[@]"
|
||||||
tmp=( '
|
tmp=( $'\n '${^tmp}')' )
|
||||||
'${^tmp}')' )
|
text+="${tmp}"
|
||||||
text="${text}${tmp}"
|
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
compstate[list]='list force'
|
compstate[list]='list force'
|
||||||
|
@ -83,8 +78,8 @@ _help_sort_tags() {
|
||||||
if [[ "$help_funcs[$curcontext]" != *${f}* ||
|
if [[ "$help_funcs[$curcontext]" != *${f}* ||
|
||||||
"$help_tags[${curcontext}${f}]" != *(${(j:|:)~argv})* ]]; then
|
"$help_tags[${curcontext}${f}]" != *(${(j:|:)~argv})* ]]; then
|
||||||
[[ "$help_funcs[$curcontext]" != *${f}* ]] &&
|
[[ "$help_funcs[$curcontext]" != *${f}* ]] &&
|
||||||
help_funcs[$curcontext]="${help_funcs[$curcontext]}:${f}"
|
help_funcs[$curcontext]+=$'\0'"${f}"
|
||||||
help_tags[${curcontext}${f}]="${help_tags[${curcontext}${f}]},${argv}:${f}"
|
help_tags[${curcontext}${f}]+=",${argv}:${f}"
|
||||||
comptry "$@"
|
comptry "$@"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue