From e5867512085e2d25eb1effbccb95df81b7ec80e7 Mon Sep 17 00:00:00 2001 From: Filip Razek Date: Sun, 21 Jan 2024 18:04:58 +0100 Subject: [PATCH] Attempt to fix integration test --- src/printer.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/printer.rs b/src/printer.rs index cb973dca..257cc766 100644 --- a/src/printer.rs +++ b/src/printer.rs @@ -287,6 +287,14 @@ impl<'a> InteractivePrinter<'a> { } } + fn get_header_component_indent_length(&self) -> usize { + if self.config.style_components.grid() && self.panel_width > 0 { + self.panel_width + 2 + } else { + self.panel_width + } + } + fn print_header_component_indent(&mut self, handle: &mut OutputHandle) -> Result<()> { if self.config.style_components.grid() { write!( @@ -317,12 +325,7 @@ impl<'a> InteractivePrinter<'a> { content: &str, ) -> Result<()> { let mut content = content; - let panel_width = if self.panel_width > 0 { - self.panel_width + 2 - } else { - 0 - }; - let content_width = self.config.term_width - panel_width; + let content_width = self.config.term_width - self.get_header_component_indent_length(); while content.len() > content_width { let (content_line, remaining) = content.split_at(content_width); self.print_header_component_with_indent(handle, content_line)?;