diff options
Diffstat (limited to 'Completion/Base/Widget/_complete_debug')
-rw-r--r-- | Completion/Base/Widget/_complete_debug | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Completion/Base/Widget/_complete_debug b/Completion/Base/Widget/_complete_debug new file mode 100644 index 000000000..1f12e8b9f --- /dev/null +++ b/Completion/Base/Widget/_complete_debug @@ -0,0 +1,24 @@ +#compdef -k complete-word \C-x? + +eval "$_comp_setup" + +(( $+_debug_count )) || integer -g _debug_count +local tmp=${TMPPREFIX}${$}${words[1]:t}$[++_debug_count] +local w="${(qq)words}" + +exec 3>&- # Too bad if somebody else is using it ... +[[ -t 2 ]] && { exec 3>&2 2>| $tmp ; trap 'exec 2>&3 3>&-' EXIT INT } + +setopt xtrace +_main_complete +integer ret=$? +unsetopt xtrace + +[[ -t 3 ]] && { + print -sR "${VISUAL:-${EDITOR:-${PAGER:-more}}} ${(q)tmp} ;: $w" + _message -r "Trace output left in $tmp (up-history to view)" + [[ $compstate[nmatches] -le 1 && $compstate[list] != *force* ]] && + compstate[list]='list force messages' +} + +return ret |