on master help sign in
Fix align_selection behaviour with tabs (#3276)
c15b494A-Walrus
helix-term/src/commands.rs+3−2
@@ -800,13 +800,14 @@ fn align_selections(cx: &mut Context) {
800 let text = doc.text().slice(..);
800 let text = doc.text().slice(..);
801 let selection = doc.selection(view.id);
801 let selection = doc.selection(view.id);
802
802
803+ let tab_width = doc.tab_width();
803 let mut column_widths: Vec<Vec<_>> = Vec::new();
804 let mut column_widths: Vec<Vec<_>> = Vec::new();
804 let mut last_line = text.len_lines() + 1;
805 let mut last_line = text.len_lines() + 1;
805 let mut col = 0;
806 let mut col = 0;
806
807
807 for range in selection {
808 for range in selection {
808− let coords = coords_at_pos(text, range.head);
809+ let coords = visual_coords_at_pos(text, range.head, tab_width);
809− let anchor_coords = coords_at_pos(text, range.anchor);
810+ let anchor_coords = visual_coords_at_pos(text, range.anchor, tab_width);
810
811
811 if coords.row != anchor_coords.row {
812 if coords.row != anchor_coords.row {
812 cx.editor
813 cx.editor