Unnamed repository; edit this file 'description' to name the repository.
| -rw-r--r-- | helix-core/src/indent.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/helix-core/src/indent.rs b/helix-core/src/indent.rs index c9415d1d..55454ebc 100644 --- a/helix-core/src/indent.rs +++ b/helix-core/src/indent.rs @@ -153,6 +153,12 @@ pub fn auto_detect_indent_style(document_text: &Rope) -> Option<IndentStyle> { // Give more weight to tabs, because their presence is a very // strong indicator. histogram[0] *= 2; + // Gives less weight to single indent, as single spaces are + // often used in certain languages' comment systems and rarely + // used as the actual document indentation. + if histogram[1] > 1 { + histogram[1] /= 2; + } histogram }; |