Skip to content

Commit

Permalink
Fix align_selection behaviour with tabs (#3276)
Browse files Browse the repository at this point in the history
  • Loading branch information
A-Walrus committed Jul 31, 2022
1 parent 7e06681 commit c15b494
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions helix-term/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<_>> = 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
Expand Down

0 comments on commit c15b494

Please sign in to comment.