Allow changes from external programs to be undone

We use a diff to be able to transform the buffer into an arbitrary
string (usually when we reread the file after an external program such
as gofmt has changed it) and still preserve undo/redo.

Fixes #136
This commit is contained in:
Zachary Yedidia
2016-05-30 21:01:40 -04:00
parent d4caf4510c
commit ef17306f8b
2 changed files with 22 additions and 5 deletions

View File

@@ -155,11 +155,7 @@ func (b *Buffer) ReOpen() {
messenger.Error(err.Error())
return
}
if txt == "" {
b.r = new(rope.Rope)
} else {
b.r = rope.New(txt)
}
b.EventHandler.ApplyDiff(txt)
b.ModTime, _ = GetModTime(b.Path)
b.IsModified = false