1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-01-19 11:31:26 +01:00

31234: use an "always" block instead of "trap" to clean up various function

overrides
This commit is contained in:
Bart Schaefer 2013-04-07 13:37:25 -07:00
parent e619a7353a
commit b4b02fbc8a
2 changed files with 38 additions and 38 deletions

View file

@ -1,3 +1,8 @@
2013-04-07 Bart Schaefer <schaefer@zsh.org>
* 31234: Completion/Base/Widget/_complete_help: use an "always"
block instead of "trap" to clean up various function overrides
2013-04-05 Frank Terbeck <ft@bewatermyfriend.org>
* 31174: Src/Zle/zle_main.c: 31174: zle: Make sure state changes
@ -664,8 +669,3 @@
2012-07-21 Peter Stephenson <p.w.stephenson@ntlworld.com>
* unposted: update for 5.0.0 release.
*****************************************************
* This is used by the shell to define $ZSH_PATCHLEVEL
* $Revision: 1.5828 $
*****************************************************

View file

@ -6,41 +6,41 @@ _complete_help() {
local _sort_tags=_help_sort_tags text i j k tmp
typeset -A help_funcs help_tags help_sfuncs help_styles
compadd() { return 1 }
zstyle() {
local _f="${${(@)${(@)funcstack[2,(i)_(main_complete|complete|approximate|normal)]}:#_(dispatch|wanted|requested|all_labels|next_label)}% *}"
{
compadd() { return 1 }
zstyle() {
local _f="${${(@)${(@)funcstack[2,(i)_(main_complete|complete|approximate|normal)]}:#_(dispatch|wanted|requested|all_labels|next_label)}% *}"
[[ -z "$_f" ]] && _f="${${(@)funcstack[2,(i)_(main_complete|complete|approximate|normal)]}:#_(dispatch|wanted|requested|all_labels|next_label)}"
if [[ "$help_sfuncs[$2]" != *${_f}* ||
"$help_styles[${2}${_f}]" != *${3}* ]]; then
[[ "$help_sfuncs[$2]" != *${_f}* ]] && help_sfuncs[$2]+=$'\0'"${_f}"
local _t
case "$1" in
-s) _t='[string] ';;
-a) _t='[array] ';;
-h) _t='[assoc] ';;
*) _t='[boolean]';;
esac
help_styles[${2}${_f}]+=",${_t} ${3}:${_f}"
fi
# No need to call the completers more than once with different match specs.
if [[ "$3" = matcher-list ]]; then
set -A "$4" ''
else
builtin zstyle "$@"
fi
}
[[ -z "$_f" ]] && _f="${${(@)funcstack[2,(i)_(main_complete|complete|approximate|normal)]}:#_(dispatch|wanted|requested|all_labels|next_label)}"
if [[ "$help_sfuncs[$2]" != *${_f}* ||
"$help_styles[${2}${_f}]" != *${3}* ]]; then
[[ "$help_sfuncs[$2]" != *${_f}* ]] && help_sfuncs[$2]+=$'\0'"${_f}"
local _t
case "$1" in
-s) _t='[string] ';;
-a) _t='[array] ';;
-h) _t='[assoc] ';;
*) _t='[boolean]';;
esac
help_styles[${2}${_f}]+=",${_t} ${3}:${_f}"
fi
# No need to call the completers more than once with different match specs.
if [[ "$3" = matcher-list ]]; then
set -A "$4" ''
else
builtin zstyle "$@"
fi
${1:-_main_complete}
} always {
unfunction compadd zstyle
}
trap 'unfunction compadd zstyle' EXIT INT
${1:-_main_complete}
unfunction compadd zstyle
trap - EXIT INT
for i in "${(@ok)help_funcs}"; do
text+=$'\n'"tags in context :completion:${i}:"