Fix #168 and #130: Escape tildes when fetching suggestions

This commit is contained in:
Eric Freese 2016-06-10 13:19:30 -06:00
parent 62cdba4e0f
commit 7c2cb38f35
3 changed files with 9 additions and 2 deletions

View file

@ -17,5 +17,5 @@ _zsh_autosuggest_escape_command() {
setopt localoptions EXTENDED_GLOB
# Escape special chars in the string (requires EXTENDED_GLOB)
echo -E "${1//(#m)[\\()\[\]|*?]/\\$MATCH}"
echo -E "${1//(#m)[\\()\[\]|*?~]/\\$MATCH}"
}

View file

@ -44,6 +44,12 @@ assertTildeSuggestion() {
'cd ~/something'
}
assertTildeSuggestionWithExtendedGlob() {
setopt local_options extended_glob
assertTildeSuggestion
}
assertParenthesesSuggestion() {
set_history <<-'EOF'
echo "$(ls foo)"
@ -87,6 +93,7 @@ testSpecialCharsForAllStrategies() {
assertBackslashSuggestion
assertDoubleBackslashSuggestion
assertTildeSuggestion
assertTildeSuggestionWithExtendedGlob
assertParenthesesSuggestion
assertSquareBracketsSuggestion
done

View file

@ -360,7 +360,7 @@ _zsh_autosuggest_escape_command() {
setopt localoptions EXTENDED_GLOB
# Escape special chars in the string (requires EXTENDED_GLOB)
echo -E "${1//(#m)[\\()\[\]|*?]/\\$MATCH}"
echo -E "${1//(#m)[\\()\[\]|*?~]/\\$MATCH}"
}
#--------------------------------------------------------------------#