fix: inconsistent tab width in unassociated text files

This commit is contained in:
sxyazi 2024-05-21 14:30:34 +08:00
parent 7177317465
commit 10a11c0bea
No known key found for this signature in database

View file

@ -97,7 +97,8 @@ impl Highlighter {
} }
if plain { if plain {
Ok(Text::from(after.join(""))) let indent = " ".repeat(PREVIEW.tab_size as usize);
Ok(Text::from(after.join("").replace('\t', &indent)))
} else { } else {
Self::highlight_with(before, after, syntax.unwrap()).await Self::highlight_with(before, after, syntax.unwrap()).await
} }