mirror of
https://github.com/zyedidia/micro.git
synced 2026-02-07 07:30:20 +09:00
Merge pull request #357 from boombuler/emptyfiles
don't reuse unsaved file buffers.
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user