mirror of
https://github.com/Hopiu/micro.git
synced 2026-03-19 23:40:31 +00:00
don't clone unsaved file buffers.
if I open multiple empty tabs, I don't want the same "new file buffers"
This commit is contained in:
parent
d0fa467a3c
commit
7d395a29a7
1 changed files with 6 additions and 4 deletions
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue