Skip to content

Commit dcb76b0

Browse files
authored
Merge pull request #86 from omani/master
fix panic on completer by checking for pos len
2 parents a108510 + 1f09822 commit dcb76b0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

completer.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func (ic iCompleter) Do(line []rune, pos int) (newLine [][]rune, length int) {
2525

2626
var cWords []string
2727
prefix := ""
28-
if len(words) > 0 && line[pos-1] != ' ' {
28+
if len(words) > 0 && pos > 0 && line[pos-1] != ' ' {
2929
prefix = words[len(words)-1]
3030
cWords = ic.getWords(words[:len(words)-1])
3131
} else {

0 commit comments

Comments
 (0)