Ensure re-used fifo buffers makes that buffer the latest opened
This commit is contained in:
parent
da1c302a37
commit
e8ad943532
|
@ -149,4 +149,11 @@ void BufferManager::arrange_buffers(ConstArrayView<String> first_ones)
|
||||||
m_buffers = std::move(res);
|
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());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ public:
|
||||||
Buffer* get_buffer_matching_ifp(const Regex& regex);
|
Buffer* get_buffer_matching_ifp(const Regex& regex);
|
||||||
Buffer& get_buffer_matching(const Regex& regex);
|
Buffer& get_buffer_matching(const Regex& regex);
|
||||||
|
|
||||||
|
void make_latest(Buffer& buffer);
|
||||||
void arrange_buffers(ConstArrayView<String> first_ones);
|
void arrange_buffers(ConstArrayView<String> first_ones);
|
||||||
|
|
||||||
Buffer& get_first_buffer();
|
Buffer& get_first_buffer();
|
||||||
|
|
|
@ -176,6 +176,7 @@ Buffer* create_fifo_buffer(String name, int fd, Buffer::Flags flags, bool scroll
|
||||||
buffer->flags() |= Buffer::Flags::NoUndo | flags;
|
buffer->flags() |= Buffer::Flags::NoUndo | flags;
|
||||||
buffer->values().clear();
|
buffer->values().clear();
|
||||||
buffer->reload({StringData::create("\n")}, ByteOrderMark::None, EolFormat::Lf, {InvalidTime, {}, {}});
|
buffer->reload({StringData::create("\n")}, ByteOrderMark::None, EolFormat::Lf, {InvalidTime, {}, {}});
|
||||||
|
buffer_manager.make_latest(*buffer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
buffer = buffer_manager.create_buffer(
|
buffer = buffer_manager.create_buffer(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user