-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Take this Code (I'm using crossterm-backend):
use terminal::{Action, Clear, error, Retrieved, Value};
use std::io::Write;
pub fn main() -> error::Result<()> {
{
let mut terminal = terminal::stdout();
// perform an single action.
terminal.act(Action::ClearTerminal(Clear::All))?;
// batch multiple actions.
for i in 0..10 {
terminal.batch(Action::MoveCursorTo(0, i))?;
terminal.write(format!("{}", i).as_bytes());
}
// execute batch.
terminal.flush_batch();
println!("\ntest1");
}
println!("test2");
Ok(())
}The output for me looks something like this:
test2
[user@host]$
2
3
4
5
6
7
8
9
test1
Is there a way to prevent this behaviour?
If not terminal seems to be not suited for use in a library, because anyone that's using the library would always need to keep an instance of the Terminal struct alive (Or at least a struct from the library using it, that itself keeps an instance of Terminal) to be able to properly print something afterwards.
EDIT:
Even when you just create an instance of Terminal and do nothing with it and end its scope, this problem occurs.
Metadata
Metadata
Assignees
Labels
No labels