mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-30 14:47:16 +09:00
Merge pull request #71 from aerth/gofmt-2
gofmt-on-save redone for new bindings
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user