mirror of
https://git.aramjonghu.dev/AramJonghu/rustlings.git
synced 2026-09-02 00:13:30 +02:00
Don't skip exercises on file changes
This commit is contained in:
+8
-1
@@ -72,7 +72,14 @@ impl<'a> WatchState<'a> {
|
||||
self.render()
|
||||
}
|
||||
|
||||
pub fn run_exercise_with_ind(&mut self, exercise_ind: usize) -> Result<()> {
|
||||
pub fn handle_file_change(&mut self, exercise_ind: usize) -> Result<()> {
|
||||
// Don't skip exercises on file changes to avoid confusion from missing exercises.
|
||||
// Skipping exercises must be explicit in the interactive list.
|
||||
// But going back to an earlier exercise on file change is fine.
|
||||
if self.app_state.current_exercise_ind() < exercise_ind {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
self.app_state.set_current_exercise_ind(exercise_ind)?;
|
||||
self.run_current_exercise()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user