1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-04-12 22:00:38 +01:00

Do not split into graphemes if not necessary

This commit is contained in:
Haris Mohamedy 2025-04-03 00:49:14 -07:00
parent a55d23aaa4
commit b5413cc015

View File

@ -405,6 +405,10 @@ impl<'a> InteractivePrinter<'a> {
content: &str,
) -> Result<()> {
let content_width = self.config.term_width - self.get_header_component_indent_length();
if content.chars().count() <= content_width {
return self.print_header_component_with_indent(handle, content);
}
let mut content_graphemes: Vec<&str> = content.graphemes(true).collect();
while content_graphemes.len() > content_width {
let (content_line, remaining) = content_graphemes.split_at(content_width);