diff --git a/src/draw_target.rs b/src/draw_target.rs index e1a3e417..49f5ab8f 100644 --- a/src/draw_target.rs +++ b/src/draw_target.rs @@ -450,7 +450,9 @@ const MAX_BURST: u8 = 20; pub(crate) struct DrawState { /// The lines to print (can contain ANSI codes) pub(crate) lines: Vec, - /// The number of lines that shouldn't be reaped by the next tick. + /// The number [`Self::lines`] entries that shouldn't be reaped by the next tick. + /// + /// Note that this number may be different than the number of visual lines required to draw [`Self::lines`]. pub(crate) orphan_lines_count: usize, /// True if we should move the cursor up when possible instead of clearing lines. pub(crate) move_cursor: bool, diff --git a/src/multi.rs b/src/multi.rs index a1167ccd..967e0f0c 100644 --- a/src/multi.rs +++ b/src/multi.rs @@ -314,20 +314,20 @@ impl MultiState { self.zombie_lines_count = 0; } - let orphan_lines_count = visual_line_count(&self.orphan_lines, width); - force_draw |= orphan_lines_count > 0; + let orphan_visual_line_count = visual_line_count(&self.orphan_lines, width); + force_draw |= orphan_visual_line_count > 0; let mut drawable = match self.draw_target.drawable(force_draw, now) { Some(drawable) => drawable, None => return Ok(()), }; let mut draw_state = drawable.state(); - draw_state.orphan_lines_count = orphan_lines_count; + draw_state.orphan_lines_count = self.orphan_lines.len(); draw_state.alignment = self.alignment; if let Some(extra_lines) = &extra_lines { draw_state.lines.extend_from_slice(extra_lines.as_slice()); - draw_state.orphan_lines_count += visual_line_count(extra_lines, width); + draw_state.orphan_lines_count += extra_lines.len(); } // Add lines from `ProgressBar::println` call.