parent
d17bed9b80
commit
33eb93b619
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user