summaryrefslogtreecommitdiff
path: root/src/selection.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2015-01-23 19:12:15 +0000
committerMaxime Coste <frrrwww@gmail.com>2015-01-23 19:12:15 +0000
commitf4e96e7f2ef7f64e3208551433abf34944f0076f (patch)
tree4dfef589a035d7a7224a5e84aae95c4ca2ef51a6 /src/selection.cc
parent02adf234b4166aefe399d0eba27ab365b36ec5a5 (diff)
Fix bug when deleting end of buffer text using multiple selections
Diffstat (limited to 'src/selection.cc')
-rw-r--r--src/selection.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/selection.cc b/src/selection.cc
index 8ad933a4..91527080 100644
--- a/src/selection.cc
+++ b/src/selection.cc
@@ -527,6 +527,15 @@ void SelectionList::erase()
sel.anchor() = sel.cursor() = m_buffer->clamp(pos.coord());
changes_tracker.update(*m_buffer, m_timestamp);
}
+
+ ByteCoord back_coord = m_buffer->back_coord();
+ for (auto& sel : m_selections)
+ {
+ if (sel.anchor() > back_coord)
+ sel.anchor() = back_coord;
+ if (sel.cursor() > back_coord)
+ sel.cursor() = back_coord;
+ }
m_buffer->check_invariant();
}