From 22b3b963a276003d5c2e9b0e6b95c3ee10e7c3ac Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Skutnik Date: Mon, 11 Nov 2024 19:51:41 +0400 Subject: [PATCH] Remove variable in unnecessary scope --- src/draw_target.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/draw_target.rs b/src/draw_target.rs index 1511efa3..d9327a7d 100644 --- a/src/draw_target.rs +++ b/src/draw_target.rs @@ -527,7 +527,6 @@ impl DrawState { // Accumulate the displayed height in here. This differs from `full_height` in that it will // not reflect the displayed content if the terminal height is exceeded. let mut real_len = VisualLines::default(); - let mut last_line_filler = 0; for (idx, line) in self.lines.iter().enumerate() { let line_width = console::measure_text_width(line); let diff = if line.is_empty() { @@ -547,7 +546,7 @@ impl DrawState { .into(); // Have all orphan lines been drawn? if self.orphan_lines_count <= idx { - // If so, then `real_height` should be at least `text_height`. + // If so, then `real_height` should be at least `orphan_visual_line_count`. debug_assert!(text_height <= real_height); // Don't consider orphan lines when comparing to terminal height. if real_height - text_height + diff > term.height().into() { @@ -562,10 +561,10 @@ impl DrawState { if idx + 1 == self.lines.len() { // Keep the cursor on the right terminal side // So that next user writes/prints will happen on the next line - last_line_filler = term_width.saturating_sub(line_width); + let last_line_filler = term_width.saturating_sub(line_width); + term.write_str(&" ".repeat(last_line_filler))?; } } - term.write_str(&" ".repeat(last_line_filler))?; term.flush()?; *bar_count = real_height - text_height + shift;