mirror of
https://github.com/Hopiu/micro.git
synced 2026-03-17 06:20:28 +00:00
parent
ead07e0b60
commit
79ee757757
2 changed files with 10 additions and 1 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -418,6 +418,10 @@ func IsNonAlphaNumeric(c rune) bool {
|
|||
return !unicode.IsLetter(c) && !unicode.IsNumber(c) && c != '_'
|
||||
}
|
||||
|
||||
func IsAutocomplete(c rune) bool {
|
||||
return c == '.' || !IsNonAlphaNumeric(c)
|
||||
}
|
||||
|
||||
func ParseSpecial(s string) string {
|
||||
return strings.Replace(s, "\\t", "\t", -1)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue