Try to improve ga behaviour

This commit is contained in:
Maxime Coste 2015-01-26 19:40:48 +00:00
parent 42966317b8
commit 92cb3a035f
2 changed files with 4 additions and 4 deletions

View File

@ -98,9 +98,7 @@ Buffer& BufferManager::get_buffer(StringView name)
void BufferManager::set_last_used_buffer(Buffer& buffer)
{
auto it = m_buffers.begin();
while (*it != &buffer and it != m_buffers.end())
++it;
auto it = find(m_buffers, &buffer);
kak_assert(it != m_buffers.end());
m_buffers.erase(it);
m_buffers.emplace(m_buffers.begin(), &buffer);

View File

@ -198,8 +198,10 @@ void goto_commands(Context& context, NormalParams params)
auto it = buffer_manager.begin();
if (it->get() == &buffer and ++it == buffer_manager.end())
break;
Buffer& target = **it;
BufferManager::instance().set_last_used_buffer(buffer);
context.push_jump();
context.change_buffer(**it);
context.change_buffer(target);
break;
}
case 'f':