mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-02 08:49:19 +00:00
Add pending UI
This commit is contained in:
parent
8df66f7991
commit
701c3ea889
@ -27,6 +27,7 @@ pub struct WatchState<'a> {
|
|||||||
show_hint: bool,
|
show_hint: bool,
|
||||||
done_status: DoneStatus,
|
done_status: DoneStatus,
|
||||||
manual_run: bool,
|
manual_run: bool,
|
||||||
|
pending: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> WatchState<'a> {
|
impl<'a> WatchState<'a> {
|
||||||
@ -40,6 +41,7 @@ impl<'a> WatchState<'a> {
|
|||||||
show_hint: false,
|
show_hint: false,
|
||||||
done_status: DoneStatus::Pending,
|
done_status: DoneStatus::Pending,
|
||||||
manual_run,
|
manual_run,
|
||||||
|
pending: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,6 +53,10 @@ impl<'a> WatchState<'a> {
|
|||||||
pub fn run_current_exercise(&mut self) -> Result<()> {
|
pub fn run_current_exercise(&mut self) -> Result<()> {
|
||||||
self.show_hint = false;
|
self.show_hint = false;
|
||||||
|
|
||||||
|
self.pending = true;
|
||||||
|
self.render()?;
|
||||||
|
self.pending = false; // remove pending UI on next render
|
||||||
|
|
||||||
let success = self
|
let success = self
|
||||||
.app_state
|
.app_state
|
||||||
.current_exercise()
|
.current_exercise()
|
||||||
@ -164,6 +170,13 @@ When you are done experimenting, enter `n` to move on to the next exercise 🦀"
|
|||||||
|
|
||||||
self.show_prompt()?;
|
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(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user