mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-11-19 13:33:52 +01:00
moved from Completion/Commands/_complete_debug
This commit is contained in:
parent
fff3958442
commit
f46287bb82
27
Completion/Base/Widget/_complete_debug
Normal file
27
Completion/Base/Widget/_complete_debug
Normal file
@ -0,0 +1,27 @@
|
||||
#compdef -k complete-word \C-x?
|
||||
|
||||
setopt localoptions ${_comp_options[@]}
|
||||
|
||||
setopt localtraps noerrexit ; trap - ZERR
|
||||
|
||||
(( $+_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
|
||||
|
||||
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'
|
||||
exec 2>&3 3>&-
|
||||
}
|
||||
|
||||
return ret
|
Loading…
Reference in New Issue
Block a user