Fix align_selection behaviour with tabs (#3276)

pull/3281/head
A-Walrus 2 years ago committed by GitHub
parent 7e06681413
commit c15b494288
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -800,13 +800,14 @@ fn align_selections(cx: &mut Context) {
let text = doc.text().slice(..); let text = doc.text().slice(..);
let selection = doc.selection(view.id); let selection = doc.selection(view.id);
let tab_width = doc.tab_width();
let mut column_widths: Vec<Vec<_>> = Vec::new(); let mut column_widths: Vec<Vec<_>> = Vec::new();
let mut last_line = text.len_lines() + 1; let mut last_line = text.len_lines() + 1;
let mut col = 0; let mut col = 0;
for range in selection { for range in selection {
let coords = coords_at_pos(text, range.head); let coords = visual_coords_at_pos(text, range.head, tab_width);
let anchor_coords = coords_at_pos(text, range.anchor); let anchor_coords = visual_coords_at_pos(text, range.anchor, tab_width);
if coords.row != anchor_coords.row { if coords.row != anchor_coords.row {
cx.editor cx.editor

Loading…
Cancel
Save