1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-11-22 05:03:56 +03:00

Ensure re-used fifo buffers makes that buffer the latest opened

This commit is contained in:
Maxime Coste 2024-04-19 17:04:41 +10:00
parent 17bec8b535
commit 2d9afcb3bf
3 changed files with 9 additions and 0 deletions

View File

@ -149,4 +149,11 @@ void BufferManager::arrange_buffers(ConstArrayView<String> first_ones)
m_buffers = std::move(res);
}
void BufferManager::make_latest(Buffer& buffer)
{
auto it = find(m_buffers, &buffer);
kak_assert(it != m_buffers.end());
std::rotate(it, it+1, m_buffers.end());
}
}

View File

@ -31,6 +31,7 @@ public:
Buffer* get_buffer_matching_ifp(const Regex& regex);
Buffer& get_buffer_matching(const Regex& regex);
void make_latest(Buffer& buffer);
void arrange_buffers(ConstArrayView<String> first_ones);
Buffer& get_first_buffer();

View File

@ -176,6 +176,7 @@ Buffer* create_fifo_buffer(String name, int fd, Buffer::Flags flags, bool scroll
buffer->flags() |= Buffer::Flags::NoUndo | flags;
buffer->values().clear();
buffer->reload({StringData::create("\n")}, ByteOrderMark::None, EolFormat::Lf, {InvalidTime, {}, {}});
buffer_manager.make_latest(*buffer);
}
else
buffer = buffer_manager.create_buffer(