diff options
| author | mo8it <mo8it@proton.me> | 2024-05-13 17:06:11 +0200 |
|---|---|---|
| committer | mo8it <mo8it@proton.me> | 2024-05-13 17:06:11 +0200 |
| commit | 4ae3fcc3caf91d4b22680ed4497c8ee05296eaad (patch) | |
| tree | 1248409373c7943a7b3c663eeead4af76a8d51c4 /src/watch/state.rs | |
| parent | 17a2d42ffd868e2049c91d7d1adbecd7f9958020 (diff) | |
Don't skip exercises on file changes
Diffstat (limited to 'src/watch/state.rs')
| -rw-r--r-- | src/watch/state.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/watch/state.rs b/src/watch/state.rs index 74cf182..60b6d5a 100644 --- a/src/watch/state.rs +++ b/src/watch/state.rs @@ -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() } |
