bugfix: panic when inserting completion with no word before cursor
This commit is contained in:
parent
7a1c82652e
commit
e3ae351f96
@ -39,7 +39,9 @@ func (p *Prompt) Run() {
|
||||
if p.chosen != -1 {
|
||||
c := p.completer(p.buf)[p.chosen]
|
||||
w := p.buf.Document().GetWordBeforeCursor()
|
||||
p.buf.DeleteBeforeCursor(len([]rune(w)))
|
||||
if w != "" {
|
||||
p.buf.DeleteBeforeCursor(len([]rune(w)))
|
||||
}
|
||||
p.buf.InsertText(c, false, true)
|
||||
}
|
||||
p.chosen = -1
|
||||
|
Loading…
Reference in New Issue
Block a user