Merge pull request #357 from boombuler/emptyfiles

don't reuse unsaved file buffers.
This commit is contained in:
Zachary Yedidia
2016-09-14 07:28:52 -04:00
committed by GitHub

View File

@@ -55,6 +55,7 @@ type SerializedBuffer struct {
// NewBuffer creates a new buffer from `txt` with path and name `path` // NewBuffer creates a new buffer from `txt` with path and name `path`
func NewBuffer(txt []byte, path string) *Buffer { func NewBuffer(txt []byte, path string) *Buffer {
if path != "" {
for _, tab := range tabs { for _, tab := range tabs {
for _, view := range tab.views { for _, view := range tab.views {
if view.Buf.Path == path { if view.Buf.Path == path {
@@ -62,6 +63,7 @@ func NewBuffer(txt []byte, path string) *Buffer {
} }
} }
} }
}
b := new(Buffer) b := new(Buffer)
b.LineArray = NewLineArray(txt) b.LineArray = NewLineArray(txt)