mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-30 14:47:16 +09:00
@@ -663,7 +663,12 @@ func (h *BufPane) Autocomplete() bool {
|
|||||||
return false
|
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)
|
// don't autocomplete if cursor is on alpha numeric character (middle of a word)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -418,6 +418,10 @@ func IsNonAlphaNumeric(c rune) bool {
|
|||||||
return !unicode.IsLetter(c) && !unicode.IsNumber(c) && c != '_'
|
return !unicode.IsLetter(c) && !unicode.IsNumber(c) && c != '_'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func IsAutocomplete(c rune) bool {
|
||||||
|
return c == '.' || !IsNonAlphaNumeric(c)
|
||||||
|
}
|
||||||
|
|
||||||
func ParseSpecial(s string) string {
|
func ParseSpecial(s string) string {
|
||||||
return strings.Replace(s, "\\t", "\t", -1)
|
return strings.Replace(s, "\\t", "\t", -1)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user