Skip to content

Commit

Permalink
Fix indentation level calculation for lines mixing tabs and spaces (h…
Browse files Browse the repository at this point in the history
  • Loading branch information
stabor705 authored and wes-adams committed Jul 3, 2023
1 parent 32c6942 commit a268357
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion helix-core/src/indent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
}
Expand Down

0 comments on commit a268357

Please sign in to comment.