about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Core/_approximate15
-rw-r--r--Completion/Core/_expand22
2 files changed, 20 insertions, 17 deletions
diff --git a/Completion/Core/_approximate b/Completion/Core/_approximate
index 9c2e35306..f10d6588c 100644
--- a/Completion/Core/_approximate
+++ b/Completion/Core/_approximate
@@ -59,9 +59,9 @@ compadd() {
     PREFIX="(#a${_comp_correct})$PREFIX"
   fi
   if [[ -n "$_correct_prompt" ]]; then
-    builtin compadd -X "$_correct_prompt" -J _correct "$@"
+    builtin compadd -X "$_correct_prompt" -J corrections "$@"
   else
-    builtin compadd -J _correct "$@"
+    builtin compadd -J corrections "$@"
   fi
 }
 
@@ -78,6 +78,11 @@ compstate[matcher]=-1
 
 _correct_prompt="${cfgps//\\%e/1}"
 
+_setup original corrections
+
+[[ "$cfgorig" != *last* ]] && builtin compadd -V original
+builtin compadd -J corrections
+
 [[ -z "$compstate[pattern_match]" ]] && compstate[pattern_match]='*'
 
 while [[ _comp_correct -le comax ]]; do
@@ -99,11 +104,7 @@ while [[ _comp_correct -le comax ]]; do
       else
         expl=(-n)
       fi
-      if [[ "$cfgorig" = *last* ]]; then
-        builtin compadd "$expl[@]" -U -V _correct_original -Q - "$PREFIX$SUFFIX"
-      elif [[ -n "$cfgorig" ]]; then
-	builtin compadd "$expl[@]" -U -Q - "$PREFIX$SUFFIX"
-      fi
+      builtin compadd "$expl[@]" -U -V original -Q - "$PREFIX$SUFFIX"
 
       # If you always want to see the list of possible corrections,
       # set `compstate[list]=list' here.
diff --git a/Completion/Core/_expand b/Completion/Core/_expand
index e611dc3e2..7598b6f88 100644
--- a/Completion/Core/_expand
+++ b/Completion/Core/_expand
@@ -82,7 +82,9 @@ fi
 
 # Quote the results and remove unnecessary quotes before `='s.
 
-    exp=( "${(@)${(@)${(@q)exp}//\\\\=/=}/#=/\\=}" )
+exp=( "${(@)${(@)${(@q)exp}//\\\\=/=}/#=/\\=}" )
+
+_setup original expansions all-expansions
 
 # We have expansions, should we menucomplete them?
 
@@ -93,15 +95,15 @@ if [[ -z "$menu" ]]; then
   # probably also adding the original string.
 
   if [[ -z "$compstate[insert]" ]]; then
-    compadd -U -V _expand -Q - "$exp[@]"
+    compadd -U -V all-expansions -Q - "$exp[@]"
   else
     [[ -n "$orig" && "$orig" != *last* ]] &&
-        compadd "$expl[@]" -UQ -V _expand_original - "$word"
+        compadd "$expl[@]" -UQ -V original - "$word"
 
     compadd -UQ -V _expand - "$exp"
 
     [[ -n "$orig" && "$orig" = *last* ]] &&
-        compadd "$expl[@]" -UQ -V _expand_original - "$word"
+        compadd "$expl[@]" -UQ -V original - "$word"
 
     compstate[insert]=menu
   fi
@@ -114,22 +116,22 @@ else
   # and/or the string containing all expanded string.
 
   [[ -n "$orig" && "$orig" != *last* ]] &&
-      compadd "$expl[@]" -UQ -V _expand_original - "$word"
+      compadd "$expl[@]" -UQ -V original - "$word"
 
   [[ $#exp -ne 1 && "$menu" = *last* && "$menu" != *only* ]] &&
-      compadd "$expl2[@]" -UQ -V _expand_all - "$exp"
+      compadd "$expl2[@]" -UQ -V all-expansions - "$exp"
 
   if [[ -z "$prompt" ]]; then
-    compadd -UQ $group _expand - "$exp[@]"
+    compadd -UQ $group expansions - "$exp[@]"
   else
     compadd -UQ -X "${prompt//\\%o/$word}" \
-            $group _expand - "$exp[@]"
+            $group expansions - "$exp[@]"
   fi
   [[ $#exp -ne 1 && "$menu" != *last* && "$menu" != *only* ]] &&
-      compadd "$expl2[@]" -UQ -V _expand_all - "$exp"
+      compadd "$expl2[@]" -UQ -V all-expansions - "$exp"
 
   [[ -n "$orig" && "$orig" = *last* ]] &&
-      compadd "$expl[@]" -UQ -V _expand_original - "$word"
+      compadd "$expl[@]" -UQ -V original - "$word"
 
   compstate[insert]=menu
 fi