Only start autocompletion for alphanumerics

Ref #1712
This commit is contained in:
Zachary Yedidia
2020-06-08 13:54:31 -04:00
parent ead07e0b60
commit 79ee757757
2 changed files with 10 additions and 1 deletions

View File

@@ -663,7 +663,12 @@ func (h *BufPane) Autocomplete() bool {
return false
}
if !util.IsNonAlphaNumeric(h.Cursor.RuneUnder(h.Cursor.X)) {
if h.Cursor.X == 0 {
return false
}
r := h.Cursor.RuneUnder(h.Cursor.X)
prev := h.Cursor.RuneUnder(h.Cursor.X - 1)
if !util.IsAutocomplete(prev) || !util.IsNonAlphaNumeric(r) {
// don't autocomplete if cursor is on alpha numeric character (middle of a word)
return false
}