Tweak Context::push_jump implementation, simplify code

This commit is contained in:
Maxime Coste 2015-12-22 22:18:25 +00:00
parent 24411569fc
commit 9e664318af

View File

@ -87,12 +87,7 @@ void Context::push_jump()
{ {
const SelectionList& jump = selections(); const SelectionList& jump = selections();
if (m_current_jump != m_jump_list.end()) if (m_current_jump != m_jump_list.end())
{ m_jump_list.erase(m_current_jump+1, m_jump_list.end());
auto begin = m_current_jump;
if (&buffer() != &begin->buffer() or *begin != jump)
++begin;
m_jump_list.erase(begin, m_jump_list.end());
}
m_jump_list.erase(std::remove(begin(m_jump_list), end(m_jump_list), jump), m_jump_list.erase(std::remove(begin(m_jump_list), end(m_jump_list), jump),
end(m_jump_list)); end(m_jump_list));
m_jump_list.push_back(jump); m_jump_list.push_back(jump);