about summary refs log tree commit diff
path: root/Completion/Core/_approximate
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>2000-02-03 17:22:40 +0000
committerTanaka Akira <akr@users.sourceforge.net>2000-02-03 17:22:40 +0000
commited41dafd3c79ebf2ce390ee9af54fe8bb21deb73 (patch)
treea45e062eb30e19f11c04c8bb7d30e36c1b77eb7e /Completion/Core/_approximate
parent52a67fbbda1eda1e45d9aa6eed6c9650fbd6d0b1 (diff)
downloadzsh-ed41dafd3c79ebf2ce390ee9af54fe8bb21deb73.tar.gz
zsh-ed41dafd3c79ebf2ce390ee9af54fe8bb21deb73.tar.xz
zsh-ed41dafd3c79ebf2ce390ee9af54fe8bb21deb73.zip
zsh-workers/9546
Diffstat (limited to 'Completion/Core/_approximate')
-rw-r--r--Completion/Core/_approximate11
1 files changed, 6 insertions, 5 deletions
diff --git a/Completion/Core/_approximate b/Completion/Core/_approximate
index bb1faa7b3..283f30e83 100644
--- a/Completion/Core/_approximate
+++ b/Completion/Core/_approximate
@@ -16,11 +16,12 @@ local curcontext="${curcontext}" oldcontext
 
 [[ "${#:-$PREFIX$SUFFIX}" -le 1 ]] && return 1
 
-[[ "$curcontext" != *:correct* ]] && curcontext="${curcontext}:approximate"
+[[ "$curcontext" != [^:]#:correct:* ]] &&
+    curcontext="${curcontext/:[^:]#:/:approximate:}"
 
 oldcontext="$curcontext"
 
-zstyle -s ":completion${curcontext}:" max-errors cfgacc
+zstyle -s ":completion:${curcontext}:" max-errors cfgacc
 
 # Get the number of errors to accept.
 
@@ -73,18 +74,18 @@ compstate[matcher]=-1
 [[ -z "$compstate[pattern_match]" ]] && compstate[pattern_match]='*'
 
 while [[ _comp_correct -le comax ]]; do
-  curcontext="${oldcontext}:$_comp_correct"
+  curcontext="${oldcontext/(#b)([^:]#:[^:]#:)/${match[1][1,-2]}-${_comp_correct}:}"
 
   _description corrections _correct_expl corrections \
                "e:$_comp_correct" "o:$PREFIX$SUFFIX"
 
   if _complete; then
-    if zstyle -t ":completion${curcontext}:" insert-unambiguous &&
+    if zstyle -t ":completion:${curcontext}:" insert-unambiguous &&
        [[ "${#compstate[unambiguous]}" -ge "${#:-$PREFIX$SUFFIX}" ]]; then
       compstate[pattern_insert]=unambiguous
     elif _requested original &&
          ( [[ compstate[nmatches] -gt 1 ]] ||
-           zstyle -t ":completion${curcontext}:" original ); then
+           zstyle -t ":completion:${curcontext}:" original ); then
       local expl
 
       _description -V original expl original