Skip to content

Commit 031361e

Browse files
author
redsti
committed
fix plugin support
1 parent 13893cc commit 031361e

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

internal/buffer/autocomplete.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ func (b *Buffer) CycleAutocomplete(forward bool) {
5858
continue
5959
}
6060

61-
activeWord, _ := b.GetWord(b.GetActiveCursor())
62-
word, _ := b.GetWord(c);
61+
activeWord, _ := b.GetWordCursor(b.GetActiveCursor())
62+
word, _ := b.GetWordCursor(c);
6363
if !bytes.Equal(word, activeWord) {
6464
continue
6565
}
@@ -100,9 +100,9 @@ func (c *Cursor) CanAutocomplete() bool {
100100
return true
101101
}
102102

103-
// GetWord gets the most recent word separated by any separator
103+
// GetWordCursor gets the most recent word separated by any separator
104104
// (whitespace, punctuation, any non alphanumeric character)
105-
func (b *Buffer) GetWord(c *Cursor) ([]byte, int) {
105+
func (b *Buffer) GetWordCursor(c *Cursor) ([]byte, int) {
106106
l := b.LineBytes(c.Y)
107107
l = util.SliceStart(l, c.X)
108108

@@ -119,6 +119,10 @@ func (b *Buffer) GetWord(c *Cursor) ([]byte, int) {
119119
return input, c.X - util.CharacterCount(input)
120120
}
121121

122+
func (b *Buffer) GetWord() ([]byte, int) {
123+
return b.GetWordCursor(b.GetActiveCursor())
124+
}
125+
122126
// GetArg gets the most recent word (separated by ' ' only)
123127
func (b *Buffer) GetArg() (string, int) {
124128
c := b.GetActiveCursor()
@@ -190,7 +194,7 @@ func FileComplete(b *Buffer) ([]string, []string) {
190194
// BufferComplete autocompletes based on previous words in the buffer
191195
func BufferComplete(b *Buffer) ([]string, []string) {
192196
c := b.GetActiveCursor()
193-
input, argstart := b.GetWord(c)
197+
input, argstart := b.GetWordCursor(c)
194198

195199
if argstart == -1 {
196200
return []string{}, []string{}

0 commit comments

Comments
 (0)