summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--Completion/Base/Widget/_complete_debug3
-rw-r--r--Completion/Base/Widget/_complete_help2
3 files changed, 7 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 4d9847062..ea5ecc98a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,10 @@
 
 	* 15018: Completion/compinit: Fix exit status of compdef.
 
+	* 15002: Completion/Base/Widget/_complete_debug,
+	Completion/Base/Widget/_complete_help: Use `trap' to restore state
+	properly in case of keyboard interrupt.
+
 2001-06-20  Bart Schaefer  <schaefer@zsh.org>
 
 	* 14880: Completion/Base/Core/_main_complete: Fix insert-tab style
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}