about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-04-02 11:14:23 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-04-02 11:14:23 +0000
commitf46287bb829833171ddad191b07ffd71fde91e70 (patch)
tree46a96ed173761d93f85697007f3b7a18da916116
parentfff39584425adc7bd099a3407b4183f185d33b84 (diff)
downloadzsh-f46287bb829833171ddad191b07ffd71fde91e70.tar.gz
zsh-f46287bb829833171ddad191b07ffd71fde91e70.tar.xz
zsh-f46287bb829833171ddad191b07ffd71fde91e70.zip
moved from Completion/Commands/_complete_debug
-rw-r--r--Completion/Base/Widget/_complete_debug27
1 files changed, 27 insertions, 0 deletions
diff --git a/Completion/Base/Widget/_complete_debug b/Completion/Base/Widget/_complete_debug
new file mode 100644
index 000000000..acdb48fd8
--- /dev/null
+++ b/Completion/Base/Widget/_complete_debug
@@ -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