Skip to content

Commit

Permalink
Kepp the cursor on the right terminal side
Browse files Browse the repository at this point in the history
  • Loading branch information
sigmaSd committed Jan 24, 2022
1 parent 954801d commit 1b13d6f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/draw_target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,10 @@ impl ProgressDrawState {
} else {
// Don't append a '\n' if this is the last line
term.write_str(line)?;
// Keep the cursor on the right terminal side
// So that next user writes/prints will happen on the next line
let line_width = console::measure_text_width(line);
term.move_cursor_right(usize::from(term.size().1) - line_width)?;
}
}
Ok(())
Expand Down

0 comments on commit 1b13d6f

Please sign in to comment.