summaryrefslogtreecommitdiff
path: root/src/editor.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2013-10-11 18:44:43 +0100
committerMaxime Coste <frrrwww@gmail.com>2013-10-11 18:44:43 +0100
commit17951bf077109e9c283d8a160fbcf05932183075 (patch)
tree5e92d85b20e6d0e6c092280ee944c0cfd39db553 /src/editor.cc
parentee0e6dcef9a4a1b370517b00110be96e0f102bcc (diff)
Fix Editor::remove_selection when the main selection is the first one and is the removed one
Diffstat (limited to 'src/editor.cc')
-rw-r--r--src/editor.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/editor.cc b/src/editor.cc
index ae156041..225d5413 100644
--- a/src/editor.cc
+++ b/src/editor.cc
@@ -250,7 +250,8 @@ void Editor::remove_selection(int index)
size_t real_index = (index + m_main_sel + 1) % m_selections.size();
m_selections.erase(m_selections.begin() + real_index);
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();
}