From 10a11c0bea3ae6e8d3b8e3b5f67e211fa7952973 Mon Sep 17 00:00:00 2001 From: sxyazi Date: Tue, 21 May 2024 14:30:34 +0800 Subject: [PATCH] fix: inconsistent tab width in unassociated text files --- yazi-plugin/src/external/highlighter.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/yazi-plugin/src/external/highlighter.rs b/yazi-plugin/src/external/highlighter.rs index b4fd6b39..0e681b96 100644 --- a/yazi-plugin/src/external/highlighter.rs +++ b/yazi-plugin/src/external/highlighter.rs @@ -97,7 +97,8 @@ impl Highlighter { } if plain { - Ok(Text::from(after.join(""))) + let indent = " ".repeat(PREVIEW.tab_size as usize); + Ok(Text::from(after.join("").replace('\t', &indent))) } else { Self::highlight_with(before, after, syntax.unwrap()).await }