diff options
| author | Mroik <mroik@delayed.space> | 2025-01-28 00:28:56 +0100 |
|---|---|---|
| committer | Mroik <mroik@delayed.space> | 2025-02-01 19:33:03 +0100 |
| commit | 240dde2cc7fb3597cbb6e18b1294edde50cac2c2 (patch) | |
| tree | 367052df35217c4b043dd94bc69f9a8f894a6c84 /src/app.rs | |
| parent | c46167db15287c13c6f7c2bd46a7bb5a6e71729e (diff) | |
Print WPM only if completed the test
Diffstat (limited to 'src/app.rs')
| -rw-r--r-- | src/app.rs | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -35,6 +35,7 @@ pub struct App { state: State, should_render: bool, start: Option<Instant>, + completed: bool, } impl App { @@ -53,6 +54,7 @@ impl App { state: State::default(), should_render: true, start: None, + completed: false, } } @@ -85,7 +87,9 @@ impl App { disable_raw_mode()?; self.stdout.execute(LeaveAlternateScreen)?; - println!("Your WPM: {}", wpm.round()); + if self.completed { + println!("Your WPM: {}", wpm.round()); + } return Ok(()); } @@ -111,6 +115,7 @@ impl App { self.state.buffer.clear(); self.state.current += 1; if self.state.current == self.quote.len() { + self.completed = true; self.running = false; } } else { |
