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,10 +55,12 @@ 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 {
for _, tab := range tabs { if path != "" {
for _, view := range tab.views { for _, tab := range tabs {
if view.Buf.Path == path { for _, view := range tab.views {
return view.Buf if view.Buf.Path == path {
return view.Buf
}
} }
} }
} }