feat: under --clear reset, always reset at exit (#797)

This commit is contained in:
Chris West 2024-04-20 06:03:19 +01:00 committed by GitHub
parent 8c22d0cac7
commit 11b98f776a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 9 deletions

View File

@ -114,15 +114,7 @@ pub fn make_config(args: &Args, state: &State) -> Result<Config> {
clearscreen::clear().ok();
}
ClearMode::Reset => {
for cs in [
ClearScreen::WindowsCooked,
ClearScreen::WindowsVt,
ClearScreen::VtLeaveAlt,
ClearScreen::VtWellDone,
ClearScreen::default(),
] {
cs.clear().ok();
}
reset_screen();
}
}
}
@ -686,3 +678,15 @@ fn emit_events_to_command(
command.stdin(stdin);
}
}
pub(crate) fn reset_screen() {
for cs in [
ClearScreen::WindowsCooked,
ClearScreen::WindowsVt,
ClearScreen::VtLeaveAlt,
ClearScreen::VtWellDone,
ClearScreen::default(),
] {
cs.clear().ok();
}
}

View File

@ -113,6 +113,11 @@ async fn run_watchexec(args: Args) -> Result<()> {
info!("running main loop");
wx.main().await.into_diagnostic()??;
if matches!(args.screen_clear, Some(args::ClearMode::Reset)) {
config::reset_screen();
}
info!("done with main loop");
Ok(())