Fix undo autocomplete

This commit is contained in:
Zachary Yedidia
2020-08-16 01:03:41 -04:00
parent 724cedd37b
commit 98b3ed0eec
4 changed files with 17 additions and 2 deletions

View File

@@ -60,7 +60,12 @@ func (b *Buffer) CycleAutocomplete(forward bool) {
if prevCompletion != -1 {
prev := b.Completions[prevCompletion]
for i := 0; i < len(prev.Edits); i++ {
b.UndoOneEvent()
if len(prev.Edits[i].Text) != 0 {
b.UndoOneEvent()
}
if !prev.Edits[i].Start.Equal(prev.Edits[i].End) {
b.UndoOneEvent()
}
}
}