From f4e96e7f2ef7f64e3208551433abf34944f0076f Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Fri, 23 Jan 2015 19:12:15 +0000 Subject: Fix bug when deleting end of buffer text using multiple selections --- src/selection.cc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') 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(); } -- cgit v1.2.3