diff --git a/src/selection.cc b/src/selection.cc index 602edd96..1ea2fdbb 100644 --- a/src/selection.cc +++ b/src/selection.cc @@ -321,6 +321,11 @@ Vector compute_modified_ranges(Buffer& buffer, size_t timestamp) for (auto& sel : ranges) { + if (buffer.is_end(sel.anchor())) + sel.anchor() = buffer.back_coord(); + if (buffer.is_end(sel.cursor())) + sel.cursor() = buffer.back_coord(); + if (sel.anchor() != sel.cursor()) sel.cursor() = buffer.char_prev(sel.cursor()); }