Skip to content

Commit

Permalink
Remove variable in unnecessary scope
Browse files Browse the repository at this point in the history
  • Loading branch information
spoutn1k authored and djc committed Nov 15, 2024
1 parent 7458c2d commit 22b3b96
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/draw_target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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() {
Expand All @@ -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;
Expand Down

0 comments on commit 22b3b96

Please sign in to comment.