Fix Editor::remove_selection when the main selection is the first one and is the removed one

This commit is contained in:
Maxime Coste 2013-10-11 18:44:43 +01:00
parent ee0e6dcef9
commit 17951bf077

View File

@ -250,7 +250,8 @@ void Editor::remove_selection(int index)
size_t real_index = (index + m_main_sel + 1) % m_selections.size(); size_t real_index = (index + m_main_sel + 1) % m_selections.size();
m_selections.erase(m_selections.begin() + real_index); m_selections.erase(m_selections.begin() + real_index);
if (real_index <= m_main_sel) if (real_index <= m_main_sel)
--m_main_sel; m_main_sel = (m_main_sel > 0 ? m_main_sel
: m_selections.size()) - 1;
} }
check_invariant(); check_invariant();
} }