diff options
Diffstat (limited to 'helix-core/src/indent.rs')
-rw-r--r-- | helix-core/src/indent.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/helix-core/src/indent.rs b/helix-core/src/indent.rs index 7ab810fd..9032d660 100644 --- a/helix-core/src/indent.rs +++ b/helix-core/src/indent.rs @@ -105,11 +105,14 @@ fn suggested_indent_for_line( line_num: usize, tab_width: usize, ) -> usize { - let line = text.line(line_num); - let current = indent_level_for_line(line, tab_width); - - if let Some(start) = find_first_non_whitespace_char(text, line_num) { - return suggested_indent_for_pos(Some(language_config), syntax, text, start, false); + if let Some(start) = find_first_non_whitespace_char(text.line(line_num)) { + return suggested_indent_for_pos( + Some(language_config), + syntax, + text, + start + text.line_to_char(line_num), + false, + ); }; // if the line is blank, indent should be zero |