aboutsummaryrefslogtreecommitdiff
path: root/helix-core
diff options
context:
space:
mode:
authorStanisław Borowy2023-03-12 17:12:06 +0000
committerGitHub2023-03-12 17:12:06 +0000
commit39052433edd4dcbd3a9714e6e3036cbd46ebc959 (patch)
tree8650bc8d27e5f94ec2cd6a6a958fdb03ae67ad81 /helix-core
parent6e432e8636f196c2c3b90a90dd762512c3d53549 (diff)
Fix indentation level calculation for lines mixing tabs and spaces (#6278)
Diffstat (limited to 'helix-core')
-rw-r--r--helix-core/src/indent.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/helix-core/src/indent.rs b/helix-core/src/indent.rs
index 950a7f65..db780ed9 100644
--- a/helix-core/src/indent.rs
+++ b/helix-core/src/indent.rs
@@ -4,6 +4,7 @@ use tree_sitter::{Query, QueryCursor, QueryPredicateArg};
use crate::{
chars::{char_is_line_ending, char_is_whitespace},
+ graphemes::tab_width_at,
syntax::{LanguageConfiguration, RopeProvider, Syntax},
tree_sitter::Node,
Rope, RopeSlice,
@@ -189,7 +190,7 @@ pub fn indent_level_for_line(line: RopeSlice, tab_width: usize, indent_width: us
let mut len = 0;
for ch in line.chars() {
match ch {
- '\t' => len += tab_width,
+ '\t' => len += tab_width_at(len, tab_width as u16),
' ' => len += 1,
_ => break,
}