Add undo/redo stack

This commit is contained in:
Zachary Yedidia
2016-03-19 18:16:10 -04:00
parent 14d25c83f4
commit 28c5899b9e
6 changed files with 190 additions and 9 deletions

View File

@@ -65,9 +65,12 @@ func (b *Buffer) Insert(idx int, value string) {
}
// Remove a slice of the rope from start to end (exclusive)
func (b *Buffer) Remove(start, end int) {
// Returns the string that was removed
func (b *Buffer) Remove(start, end int) string {
removed := b.text[start:end]
b.r.Remove(start, end)
b.Update()
return removed
}
// Len gives the length of the buffer