feat: under --clear reset, always reset at exit (#797)
This commit is contained in:
parent
8c22d0cac7
commit
11b98f776a
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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(())
|
||||
|
|
Loading…
Reference in New Issue