Add new buffers at the back of the buffer list
This will be reverted if we discover why we were doing things the over way around. Fixes #1881
This commit is contained in:
parent
f018a29b58
commit
21603983c5
|
@ -36,15 +36,14 @@ Buffer* BufferManager::create_buffer(String name, Buffer::Flags flags,
|
|||
throw runtime_error{"buffer name is already in use"};
|
||||
}
|
||||
|
||||
m_buffers.emplace(m_buffers.begin(),
|
||||
new Buffer{std::move(name), flags, data, fs_timestamp});
|
||||
auto& buffer = *m_buffers.front();
|
||||
buffer.on_registered();
|
||||
m_buffers.push_back(std::make_unique<Buffer>(std::move(name), flags, data, fs_timestamp));
|
||||
auto* buffer = m_buffers.back().get();
|
||||
buffer->on_registered();
|
||||
|
||||
if (contains(m_buffer_trash, &buffer))
|
||||
if (contains(m_buffer_trash, buffer))
|
||||
throw runtime_error{"Buffer got removed during its creation"};
|
||||
|
||||
return &buffer;
|
||||
return buffer;
|
||||
}
|
||||
|
||||
void BufferManager::delete_buffer(Buffer& buffer)
|
||||
|
@ -86,7 +85,7 @@ Buffer& BufferManager::get_first_buffer()
|
|||
if (all_of(m_buffers, [](auto& b) { return (b->flags() & Buffer::Flags::Debug); }))
|
||||
create_buffer("*scratch*", Buffer::Flags::None);
|
||||
|
||||
return *m_buffers.front();
|
||||
return *m_buffers.back();
|
||||
}
|
||||
|
||||
void BufferManager::backup_modified_buffers()
|
||||
|
|
Loading…
Reference in New Issue
Block a user