mirror of
https://github.com/helix-editor/helix.git
synced 2025-10-06 00:13:28 +02:00
Reduce weight of 1 space indents in indent detection (#14088)
This commit is contained in:
@@ -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
|
||||
};
|
||||
|
Reference in New Issue
Block a user