mirror of
				https://github.com/sharkdp/bat.git
				synced 2025-11-04 09:01:56 +00:00 
			
		
		
		
	Do not split into graphemes if not necessary
This commit is contained in:
		@@ -405,6 +405,10 @@ impl<'a> InteractivePrinter<'a> {
 | 
				
			|||||||
        content: &str,
 | 
					        content: &str,
 | 
				
			||||||
    ) -> Result<()> {
 | 
					    ) -> Result<()> {
 | 
				
			||||||
        let content_width = self.config.term_width - self.get_header_component_indent_length();
 | 
					        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();
 | 
					        let mut content_graphemes: Vec<&str> = content.graphemes(true).collect();
 | 
				
			||||||
        while content_graphemes.len() > content_width {
 | 
					        while content_graphemes.len() > content_width {
 | 
				
			||||||
            let (content_line, remaining) = content_graphemes.split_at(content_width);
 | 
					            let (content_line, remaining) = content_graphemes.split_at(content_width);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user