diff options
author | Wojciech Kępka | 2021-06-08 07:11:45 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-06-08 08:22:37 +0000 |
commit | c978d811d96d03acf04ddbe5af66fff57c17e287 (patch) | |
tree | d7e9c0deb5ee6addf25381ab977ca2714d06cc31 /helix-core/src/indent.rs | |
parent | 48df05b16dba362366b63284c2e551c51995fb66 (diff) |
Cleanup find_first_non_whitespace_char funcs
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 |