From 701c3ea88933cf284ad93a04622cea3d53d036bf Mon Sep 17 00:00:00 2001 From: Remo Senekowitsch Date: Thu, 8 Aug 2024 14:26:09 +0200 Subject: [PATCH] Add pending UI --- src/watch/state.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/watch/state.rs b/src/watch/state.rs index 46f48d9f..66aff0a7 100644 --- a/src/watch/state.rs +++ b/src/watch/state.rs @@ -27,6 +27,7 @@ pub struct WatchState<'a> { show_hint: bool, done_status: DoneStatus, manual_run: bool, + pending: bool, } impl<'a> WatchState<'a> { @@ -40,6 +41,7 @@ impl<'a> WatchState<'a> { show_hint: false, done_status: DoneStatus::Pending, manual_run, + pending: false, } } @@ -51,6 +53,10 @@ impl<'a> WatchState<'a> { pub fn run_current_exercise(&mut self) -> Result<()> { self.show_hint = false; + self.pending = true; + self.render()?; + self.pending = false; // remove pending UI on next render + let success = self .app_state .current_exercise() @@ -164,6 +170,13 @@ When you are done experimenting, enter `n` to move on to the next exercise 🦀" self.show_prompt()?; + // TODO remove the whole pending logic once this is fixed: + // https://github.com/rust-lang/rustlings/issues/2071 + if self.pending { + self.writer + .write_all(b"\n\nChecking the exercises...\n\nThank you for your patience...\n")?; + } + Ok(()) }