From c15b494288c27fd97e15f31baf056923fae1b94c Mon Sep 17 00:00:00 2001 From: A-Walrus <58790821+A-Walrus@users.noreply.github.com> Date: Sun, 31 Jul 2022 22:45:51 +0300 Subject: [PATCH] Fix align_selection behaviour with tabs (#3276) --- helix-term/src/commands.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 1c5cbf400..f12c79f93 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -800,13 +800,14 @@ fn align_selections(cx: &mut Context) { let text = doc.text().slice(..); let selection = doc.selection(view.id); + let tab_width = doc.tab_width(); let mut column_widths: Vec> = Vec::new(); let mut last_line = text.len_lines() + 1; let mut col = 0; for range in selection { - let coords = coords_at_pos(text, range.head); - let anchor_coords = coords_at_pos(text, range.anchor); + let coords = visual_coords_at_pos(text, range.head, tab_width); + let anchor_coords = visual_coords_at_pos(text, range.anchor, tab_width); if coords.row != anchor_coords.row { cx.editor