From 7d395a29a7c52e46d296ea0b0a9cdecf688ed040 Mon Sep 17 00:00:00 2001 From: boombuler Date: Wed, 14 Sep 2016 09:37:12 +0200 Subject: [PATCH] don't clone unsaved file buffers. if I open multiple empty tabs, I don't want the same "new file buffers" --- cmd/micro/buffer.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cmd/micro/buffer.go b/cmd/micro/buffer.go index aea7c030..0d893fda 100644 --- a/cmd/micro/buffer.go +++ b/cmd/micro/buffer.go @@ -55,10 +55,12 @@ type SerializedBuffer struct { // NewBuffer creates a new buffer from `txt` with path and name `path` func NewBuffer(txt []byte, path string) *Buffer { - for _, tab := range tabs { - for _, view := range tab.views { - if view.Buf.Path == path { - return view.Buf + if path != "" { + for _, tab := range tabs { + for _, view := range tab.views { + if view.Buf.Path == path { + return view.Buf + } } } }