mirror of
https://github.com/danog/ytop.git
synced 2024-11-30 04:29:10 +01:00
clear screen on exit if in TTY (Close #36)
This commit is contained in:
parent
8efb816674
commit
0ed8d75fa7
@ -35,6 +35,8 @@ fn setup_terminal() -> Result<Terminal<CrosstermBackend<io::Stdout>>> {
|
||||
|
||||
execute!(stdout, terminal::EnterAlternateScreen)?;
|
||||
execute!(stdout, cursor::Hide)?;
|
||||
|
||||
// for TTYs
|
||||
execute!(stdout, terminal::Clear(terminal::ClearType::All))?;
|
||||
|
||||
terminal::enable_raw_mode()?;
|
||||
@ -48,6 +50,10 @@ fn setup_terminal() -> Result<Terminal<CrosstermBackend<io::Stdout>>> {
|
||||
fn cleanup_terminal() -> Result<()> {
|
||||
let mut stdout = io::stdout();
|
||||
|
||||
// for TTYs
|
||||
execute!(stdout, cursor::MoveTo(0, 0))?;
|
||||
execute!(stdout, terminal::Clear(terminal::ClearType::All))?;
|
||||
|
||||
execute!(stdout, terminal::LeaveAlternateScreen)?;
|
||||
execute!(stdout, cursor::Show)?;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user