Skip debug buffer when cycling through the buffer list

Fixes #1059
This commit is contained in:
Maxime Coste 2016-12-23 16:37:54 +00:00
parent d17bed9b80
commit 33eb93b619

View File

@ -523,22 +523,26 @@ void cycle_buffer(const ParametersParser& parser, Context& context, const ShellC
auto it = find_if(BufferManager::instance(),
[oldbuf](const std::unique_ptr<Buffer>& lhs)
{ return lhs.get() == oldbuf; });
kak_assert(it != BufferManager::instance().end());
if (not next)
{
if (it == BufferManager::instance().begin())
it = BufferManager::instance().end();
--it;
}
else
{
if (++it == BufferManager::instance().end())
it = BufferManager::instance().begin();
}
Buffer* newbuf = it->get();
Buffer* newbuf = nullptr;
auto cycle = [&] {
if (not next)
{
if (it == BufferManager::instance().begin())
it = BufferManager::instance().end();
--it;
}
else
{
if (++it == BufferManager::instance().end())
it = BufferManager::instance().begin();
}
newbuf = it->get();
};
cycle();
if (newbuf->flags() & Buffer::Flags::Debug)
cycle();
if (newbuf != oldbuf)
{