diff --git a/crates/cli/src/config.rs b/crates/cli/src/config.rs index 90668cd..87aaf15 100644 --- a/crates/cli/src/config.rs +++ b/crates/cli/src/config.rs @@ -114,15 +114,7 @@ pub fn make_config(args: &Args, state: &State) -> Result { 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(); + } +} diff --git a/crates/cli/src/lib.rs b/crates/cli/src/lib.rs index beca210..f328e6f 100644 --- a/crates/cli/src/lib.rs +++ b/crates/cli/src/lib.rs @@ -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(())