diff --git a/Completion/Base/Completer/_prefix b/Completion/Base/Completer/_prefix index 74be5f4..e256079 100644 --- a/Completion/Base/Completer/_prefix +++ b/Completion/Base/Completer/_prefix @@ -50,13 +50,19 @@ for tmp in "$comp[@]"; do        if [[ "$tmp" != _prefix ]] && "$tmp"; then        [[ compstate[nmatches] -gt 1 ]] && return 0 -      compadd -U -i "$IPREFIX" -I "$ISUFFIX" - "${compstate[unambiguous]%$suf}x" -      compstate[list]= -      if [[ -n $compstate[unambiguous] ]]; then -        compstate[insert]=unambiguous -      else +      # Does the following need pattern quoting on $PREFIX? +      if [[ ${compstate[unambiguous]} = "$PREFIX"* ]]; then +        # We completed something following the original prefix          compstate[insert]=0 +        compstate[to_end]= +      else +        # We completed something inside the original prefix +        compstate[insert]=unambiguous +      fi +      if [[ $compstate[nmatches] -eq 0 ]]; then +        compadd -U -i "$IPREFIX" -S "$ISUFFIX" - "${compstate[unambiguous]%$suf}"        fi +      compstate[list]=        return 0      fi      (( _matcher_num++ ))