Only define _hsmw_main() once – check $functions before defining

This commit is contained in:
Sebastian Gniazdowski 2016-10-27 18:22:58 +02:00
parent aee52a54ac
commit 619d9c7184

View file

@ -39,6 +39,8 @@ typeset -gaU __hsmw_hcw_found
(( __hsmw_hcw_call_count ++ ))
trap '(( __hsmw_hcw_call_count -- )); return 0;' INT
if (( ${+functions[_hsmw_main]} == 0 )); then
_hsmw_main() {
# First call or restart?
if [[ "$__hsmw_hcw_call_count" -le 1 || "$__hsmw_hcw_restart" = "1" ]]; then
@ -165,6 +167,8 @@ _hsmw_main() {
region_highlight+=( "$(( offset + ${#txt_before} )) $(( offset + ${#txt_before} + ${#entry} + 1 )) $__hsmw_active" )
}
fi
_hsmw_main
_hsmw_simulate_widget() {