@@ -1342,8 +1342,17 @@ fn copy_selection_on_line(cx: &mut Context, direction: Direction) {
1342 let mut primary_index = 0;
1342 let mut primary_index = 0;
1343 for range in selection.iter() {
1343 for range in selection.iter() {
1344 let is_primary = *range == selection.primary();
1344 let is_primary = *range == selection.primary();
1346+ // The range is always head exclusive
1347+ let head = if range.anchor < range.head {
1345− let head_pos = coords_at_pos(text, range.head);
1353+ let head_pos = coords_at_pos(text, head);
1346 let anchor_pos = coords_at_pos(text, range.anchor);
1354 let anchor_pos = coords_at_pos(text, range.anchor);
1347 let height = std::cmp::max(head_pos.row, anchor_pos.row)
1356 let height = std::cmp::max(head_pos.row, anchor_pos.row)
1348 - std::cmp::min(head_pos.row, anchor_pos.row)
1357 - std::cmp::min(head_pos.row, anchor_pos.row)