@@ -1411,16 +1411,16 @@ fn copy_selection_on_line(cx: &mut Context, direction: Direction) {
14111411 let is_primary = *range == selection.primary();
14121412
14131413 // The range is always head exclusive
1414− let head = if range.anchor < range.head {
1415− range.head - 1
1414+ let (head, anchor) = if range.anchor < range.head {
1415+ (range.head - 1, range.anchor)
14161416 } else {
1417− range.head
1417+ (range.head, range.anchor - 1)
14181418 };
14191419
14201420 let tab_width = doc.tab_width();
14211421
14221422 let head_pos = visual_coords_at_pos(text, head, tab_width);
1423− let anchor_pos = visual_coords_at_pos(text, range.anchor, tab_width);
1423+ let anchor_pos = visual_coords_at_pos(text, anchor, tab_width);
14241424
14251425 let height = std::cmp::max(head_pos.row, anchor_pos.row)
14261426 - std::cmp::min(head_pos.row, anchor_pos.row)