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(), auto it = find_if(BufferManager::instance(),
[oldbuf](const std::unique_ptr<Buffer>& lhs) [oldbuf](const std::unique_ptr<Buffer>& lhs)
{ return lhs.get() == oldbuf; }); { return lhs.get() == oldbuf; });
kak_assert(it != BufferManager::instance().end()); kak_assert(it != BufferManager::instance().end());
if (not next) Buffer* newbuf = nullptr;
{ auto cycle = [&] {
if (it == BufferManager::instance().begin()) if (not next)
it = BufferManager::instance().end(); {
--it; if (it == BufferManager::instance().begin())
} it = BufferManager::instance().end();
else --it;
{ }
if (++it == BufferManager::instance().end()) else
it = BufferManager::instance().begin(); {
} if (++it == BufferManager::instance().end())
it = BufferManager::instance().begin();
Buffer* newbuf = it->get(); }
newbuf = it->get();
};
cycle();
if (newbuf->flags() & Buffer::Flags::Debug)
cycle();
if (newbuf != oldbuf) if (newbuf != oldbuf)
{ {