summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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();
}