summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Base/Completer/_approximate11
1 files changed, 6 insertions, 5 deletions
diff --git a/Completion/Base/Completer/_approximate b/Completion/Base/Completer/_approximate
index 3ed8be730..39518803e 100644
--- a/Completion/Base/Completer/_approximate
+++ b/Completion/Base/Completer/_approximate
@@ -49,15 +49,16 @@ _tags corrections original
 
 if (( ! $+functions[compadd] )); then
   compadd() {
+    local ppre="$argv[(I)-p]"
+
     [[ ${argv[(I)-[a-zA-Z]#U[a-zA-Z]#]} -eq 0 &&
        "${#:-$PREFIX$SUFFIX}" -le _comp_correct ]] && return
 
-    ### This distinction doesn't seem to be needed anymore
-    # if [[ "$PREFIX" = \~*/* ]]; then
-    #   PREFIX="${PREFIX%%/*}/(#a${_comp_correct})${PREFIX#*/}"
-    # else
+    if [[ "$PREFIX" = \~* && ( ppre -eq 0 || "$argv[ppre+1]" != \~* ) ]]; then
+      PREFIX="~(#a${_comp_correct})${PREFIX[2,-1]}"
+    else
       PREFIX="(#a${_comp_correct})$PREFIX"
-    # fi
+    fi
 
     (( $_correct_group && $argv[(I)-*[JV]] )) &&
         _correct_expl[_correct_group]=${argv[(R)-*[JV]]}