Fix undo of MultipleReplace

Fixes #799
This commit is contained in:
Zachary Yedidia
2017-09-04 16:21:08 -04:00
parent efff850e54
commit d41a255361

View File

@@ -48,6 +48,11 @@ func ExecuteTextEvent(t *TextEvent, buf *Buffer) {
for i, d := range t.Deltas {
t.Deltas[i].Text = buf.remove(d.Start, d.End)
buf.insert(d.Start, []byte(d.Text))
t.Deltas[i].Start = d.Start
t.Deltas[i].End = Loc{d.Start.X + Count(d.Text), d.Start.Y}
}
for i, j := 0, len(t.Deltas)-1; i < j; i, j = i+1, j-1 {
t.Deltas[i], t.Deltas[j] = t.Deltas[j], t.Deltas[i]
}
}
}