summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Base/Widget/_complete_debug3
-rw-r--r--Completion/Base/Widget/_complete_help2
2 files changed, 3 insertions, 2 deletions
diff --git a/Completion/Base/Widget/_complete_debug b/Completion/Base/Widget/_complete_debug
index 6f670c8a9..1f12e8b9f 100644
--- a/Completion/Base/Widget/_complete_debug
+++ b/Completion/Base/Widget/_complete_debug
@@ -7,7 +7,7 @@ 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
+[[ -t 2 ]] && { exec 3>&2 2>| $tmp ; trap 'exec 2>&3 3>&-' EXIT INT }
 
 setopt xtrace
 _main_complete
@@ -19,7 +19,6 @@ unsetopt xtrace
     _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
diff --git a/Completion/Base/Widget/_complete_help b/Completion/Base/Widget/_complete_help
index ffbcf0caa..69930e105 100644
--- a/Completion/Base/Widget/_complete_help
+++ b/Completion/Base/Widget/_complete_help
@@ -35,10 +35,12 @@ _complete_help() {
       builtin zstyle "$@"
     fi
   }
+  trap 'unfunction compadd zstyle' EXIT INT
 
   _main_complete
 
   unfunction compadd zstyle
+  trap - EXIT INT
 
   for i in "${(@ok)help_funcs}"; do
     text="${text}