diff --git a/src/selection.cc b/src/selection.cc index 1c39c8a7..5c8f2707 100644 --- a/src/selection.cc +++ b/src/selection.cc @@ -379,8 +379,8 @@ static void fix_overflowing_selections(Vector& selections, const BufferCoord back_coord = buffer.back_coord(); for (auto& sel : selections) { - auto pos = buffer.clamp(sel.cursor()); - sel.anchor() = sel.cursor() = std::min(pos, back_coord); + sel.cursor() = std::min(buffer.clamp(sel.cursor()), back_coord); + sel.anchor() = std::min(buffer.clamp(sel.anchor()), back_coord); } }