File tree Expand file tree Collapse file tree 1 file changed +14
-7
lines changed
Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -49,19 +49,26 @@ func (b *Buffer) CycleAutocomplete(forward bool) {
4949 b .CurSuggestion = len (b .Suggestions ) - 1
5050 }
5151
52- c := b .GetActiveCursor ()
53- start := c .Loc
54- end := c .Loc
55- if prevSuggestion < len (b .Suggestions ) && prevSuggestion >= 0 {
56- start = end .Move (- util .CharacterCountInString (b .Completions [prevSuggestion ]), b )
57- }
52+ b .performAutoComplete (prevSuggestion )
5853
59- b .Replace (start , end , b .Completions [b .CurSuggestion ])
6054 if len (b .Suggestions ) > 1 {
6155 b .HasSuggestions = true
6256 }
6357}
6458
59+ func (b * Buffer ) performAutoComplete (prevSuggestion int ) {
60+ for _ , cur := range b .cursors {
61+ curLoc := cur .Loc
62+ curStart := curLoc
63+ curEnd := curLoc
64+
65+ if prevSuggestion < len (b .Suggestions ) && prevSuggestion >= 0 {
66+ curStart = curEnd .Move (- util .CharacterCountInString (b .Completions [prevSuggestion ]), b )
67+ }
68+ b .Replace (curStart , curEnd , b .Completions [b .CurSuggestion ])
69+ }
70+ }
71+
6572// GetWord gets the most recent word separated by any separator
6673// (whitespace, punctuation, any non alphanumeric character)
6774func (b * Buffer ) GetWord () ([]byte , int ) {
You can’t perform that action at this time.
0 commit comments