on master help sign in
Fix align_selection behaviour with tabs (#3276)
commitc15b494288c27fd97e15f31baf056923fae1b94c authorA-Walrus <58790821+A-Walrus@users.noreply.github.com> dateSun 31 Jul 2022, 22:45 (4 years ago) parent7e06681
1 file changed+3−2
helix-term/src/commands.rs+3−2
helix-term/src/commands.rs+3−2
@@ -800,13 +800,14 @@ fn align_selections(cx: &mut Context) {
800800 let text = doc.text().slice(..);
801801 let selection = doc.selection(view.id);
802802
803+ let tab_width = doc.tab_width();
803804 let mut column_widths: Vec<Vec<_>> = Vec::new();
804805 let mut last_line = text.len_lines() + 1;
805806 let mut col = 0;
806807
807808 for range in selection {
808− let coords = coords_at_pos(text, range.head);
809− let anchor_coords = coords_at_pos(text, range.anchor);
809+ let coords = visual_coords_at_pos(text, range.head, tab_width);
810+ let anchor_coords = visual_coords_at_pos(text, range.anchor, tab_width);
810811
811812 if coords.row != anchor_coords.row {
812813 cx.editor