aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorA-Walrus2022-07-31 19:45:51 +0000
committerGitHub2022-07-31 19:45:51 +0000
commitc15b494288c27fd97e15f31baf056923fae1b94c (patch)
tree8939a31c924578bbd3cd8c88df4692ec1109eae2 /helix-term/src
parent7e066814133c62ab76a2da8dd021b6001f3b70f9 (diff)
Fix align_selection behaviour with tabs (#3276)
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/commands.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 1c5cbf40..f12c79f9 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<_>> = 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