about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBart Schaefer <barts@users.sourceforge.net>2001-04-27 03:20:59 +0000
committerBart Schaefer <barts@users.sourceforge.net>2001-04-27 03:20:59 +0000
commita509b259f889404b3c821a19243ebde19d582aaf (patch)
treeac8d568fb52c62bab09826b77b43141bdf06d74e
parentee404f2cfff0ff79f7bdf7d16b37f56ee295d263 (diff)
downloadzsh-a509b259f889404b3c821a19243ebde19d582aaf.tar.gz
zsh-a509b259f889404b3c821a19243ebde19d582aaf.tar.xz
zsh-a509b259f889404b3c821a19243ebde19d582aaf.zip
Use trap for unfunction compadd in _approximate.
-rw-r--r--ChangeLog7
-rw-r--r--Completion/Base/Completer/_approximate6
2 files changed, 9 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 2fe2920dc..5fc82d5fe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2001-04-26  Bart Schaefer  <schaefer@zsh.org>
+
+	* 14129: Completion/Base/Completer/_approximate: Use a trap to
+	unfunction the `compadd' function so that it can be correctly
+	removed in the event that the competion system is interrupted by
+	a keyboard signal.
+
 2001-04-26  Clint Adams  <clint@zsh.org>
 
         * 14125: Src/Modules/termcap.c, Src/Modules/terminfo.c:
diff --git a/Completion/Base/Completer/_approximate b/Completion/Base/Completer/_approximate
index 0b64db593..6e094cd45 100644
--- a/Completion/Base/Completer/_approximate
+++ b/Completion/Base/Completer/_approximate
@@ -10,7 +10,7 @@
 
 [[ _matcher_num -gt 1 || "${#:-$PREFIX$SUFFIX}" -le 1 ]] && return 1
 
-local _comp_correct _correct_expl comax cfgacc redef match
+local _comp_correct _correct_expl comax cfgacc match
 local oldcontext="${curcontext}" opm="$compstate[pattern_match]"
 
 if [[ "$1" = -a* ]]; then
@@ -48,7 +48,6 @@ _tags corrections original
 # ignored prefix).
 
 if (( ! $+functions[compadd] )); then
-  redef=yes
   compadd() {
     [[ ${argv[(I)-[a-zA-Z]#U[a-zA-Z]#]} -eq 0 &&
        "${#:-$PREFIX$SUFFIX}" -le _comp_correct ]] && return
@@ -61,6 +60,7 @@ if (( ! $+functions[compadd] )); then
     # fi
     builtin compadd "$_correct_expl[@]" "$@"
   }
+  trap 'unfunction compadd' EXIT INT
 fi
 
 _comp_correct=1
@@ -92,7 +92,6 @@ while [[ _comp_correct -le comax ]]; do
       [[ "$compstate[list]" != list* ]] &&
           compstate[list]="$compstate[list] force"
     fi
-    [[ -n "$redef" ]] && unfunction compadd
     compstate[pattern_match]="$opm"
 
     return 0
@@ -102,7 +101,6 @@ while [[ _comp_correct -le comax ]]; do
   (( _comp_correct++ ))
 done
 
-[[ -n "$redef" ]] && unfunction compadd
 compstate[pattern_match]="$opm"
 
 return 1