@@ -11,14 +11,14 @@ import (
1111 "time"
1212
1313 shellquote "github.com/kballard/go-shellquote"
14+ "github.com/micro-editor/tcell/v2"
1415 "github.com/zyedidia/micro/v2/internal/buffer"
1516 "github.com/zyedidia/micro/v2/internal/clipboard"
1617 "github.com/zyedidia/micro/v2/internal/config"
1718 "github.com/zyedidia/micro/v2/internal/display"
1819 "github.com/zyedidia/micro/v2/internal/screen"
1920 "github.com/zyedidia/micro/v2/internal/shell"
2021 "github.com/zyedidia/micro/v2/internal/util"
21- "github.com/micro-editor/tcell/v2"
2222)
2323
2424// ScrollUp is not an action
@@ -901,19 +901,17 @@ func (h *BufPane) OutdentSelection() bool {
901901// Autocomplete cycles the suggestions and performs autocompletion if there are suggestions
902902func (h * BufPane ) Autocomplete () bool {
903903 b := h .Buf
904+ cc := buffer .AutocompleteCursorCheck (h .Cursor )
905+ rc := buffer .AutocompleteRuneCheck (h .Cursor )
904906
905907 // Don't autocomplete at all if the active cursor cannot be autocomplete
906- if ! buffer .AutocompleteCheck (h .Cursor ) {
907- return false
908- }
909-
910- if ! b .HasSuggestions && ! b .StartAutocomplete (buffer .BufferComplete ) {
908+ if ! b .HasSuggestions && (! rc || ! cc || ! b .StartAutocomplete (buffer .BufferComplete )) {
911909 return false
912910 }
913911
914912 prevSuggestion := b .CycleAutocomplete (true )
915913 for i := 0 ; i < b .NumCursors (); i ++ {
916- if buffer .AutocompleteCheck (b .GetCursor (i )) {
914+ if buffer .AutocompleteCursorCheck (b .GetCursor (i )) {
917915 b .PerformSingleAutocomplete (prevSuggestion , b .GetCursor (i ))
918916 }
919917 }
@@ -931,7 +929,7 @@ func (h *BufPane) CycleAutocompleteBack() bool {
931929 if b .HasSuggestions {
932930 prevSuggestion := b .CycleAutocomplete (false )
933931 for i := 0 ; i < b .NumCursors (); i ++ {
934- if buffer .AutocompleteCheck (b .GetCursor (i )) {
932+ if buffer .AutocompleteCursorCheck (b .GetCursor (i )) {
935933 b .PerformSingleAutocomplete (prevSuggestion , b .GetCursor (i ))
936934 }
937935 }
0 commit comments