Merge pull request #71 from aerth/gofmt-2

gofmt-on-save redone for new bindings
This commit is contained in:
Zachary Yedidia
2016-04-24 07:47:48 -04:00
3 changed files with 95 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
package main
import (
"io/ioutil"
"strconv"
"strings"
"time"
@@ -169,6 +170,23 @@ func (v *View) OpenBuffer(buf *Buffer) {
v.lastClickTime = time.Time{}
}
// Close and Re-open the current file.
func (v *View) reOpen() {
if v.CanClose("Continue? (yes, no, save) ") {
file, err := ioutil.ReadFile(v.buf.path)
filename := v.buf.name
if err != nil {
messenger.Error(err.Error())
return
}
buf := NewBuffer(string(file), filename)
v.buf = buf
v.matches = Match(v)
v.Relocate()
}
}
// OpenFile opens a new file in the current view
// It makes sure that the current buffer can be closed first (unsaved changes)
func (v *View) OpenFile() {