I have a main method that looks like this:
use std::io::stdout;
use crossterm as ct;
use crossterm::terminal as ct_terminal;
pub mod tui;
fn main() -> () {
let user_result: usize = tui::select_choice("", &[]);
}
The function that's called (tui::select_choice()
) looks like this:
use std::{thread::sleep, time::Duration};
use crossterm::terminal::{Clear, ClearType::Purge};
use crossterm::ExecutableCommand;
use std::io::stdout;
pub fn select_choice(pre_text: &str, options: &[&str]) -> usize {
println!("Na");
sleep(Duration::from_secs(5));
stdout().execute(Clear(Purge));
println!("ima do my own thing");
sleep(Duration::from_secs(5));
2 as usize
}
The program runs but the terminal won't clear. It just prints on the next line:
Na
ima do my own thing
H:\Code\Rust\GTFO>