From 758e807e0f094c3691bec6d232349a1963ddfb86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radli=C5=84ski=20Ignacy?= Date: Sat, 19 Oct 2024 10:49:09 +0200 Subject: [PATCH] use 's' instead of 'e' to start the test (#60) --- README.md | 4 ++-- src/main.rs | 2 +- src/runner.rs | 4 ++-- tests/cli.rs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 7ec289f..3dc7987 100644 --- a/README.md +++ b/README.md @@ -8,11 +8,11 @@ a _very_ minimalistic _cli_ typing test. When you run the program, you'll find the expected input displayed at the top of your terminal window. This text serves as a placeholder and represents what you should type when the test begins. Your goal is to type this text as quickly as possible. If you make a mistake, you can press the `backspace` key to delete a single character or hold down `Option`/`Ctrl` and press `backspace` to delete an entire word. -In the top-right corner of the screen, a helpful message prompts you to start the test by pressing `'e'` (to enter the test) or exit by pressing `'q'`. +In the top-right corner of the screen, a helpful message prompts you to start the test by pressing `'s'` (to enter the test) or exit by pressing `'q'`. While the test is running, you'll be able to monitor the time remaining in the top-left corner of the screen. -To pause the test, simply press ``. To resume, press `'e'` again. +To pause the test, simply press ``. To resume, press `'s'` again. Your WPM (words per minute) score is calculated based on the number of typed characters divided by 5 (word), and normalized to a 60-second timeframe (minute). diff --git a/src/main.rs b/src/main.rs index 13bea60..f41f47e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -344,7 +344,7 @@ mod tests { let text = extract_text_from_buffer(terminal.backend().buffer()); - let predicate = predicates::str::contains("press 'e' to start the test, press 'q' to quit"); + let predicate = predicates::str::contains("press 's' to start the test, press 'q' to quit"); assert_eq!(true, predicate.eval(&text)); diff --git a/src/runner.rs b/src/runner.rs index f044c19..95b788d 100644 --- a/src/runner.rs +++ b/src/runner.rs @@ -109,7 +109,7 @@ impl Runner { if key.kind == KeyEventKind::Press { match self.input_mode { InputMode::Normal => match key.code { - KeyCode::Char('e') => { + KeyCode::Char('s') => { start_time = if is_started { start_time + pause_time.elapsed() } else { @@ -274,7 +274,7 @@ impl Runner { ); let help_message = match self.input_mode { - InputMode::Normal => "press 'e' to start the test, press 'q' to quit", + InputMode::Normal => "press 's' to start the test, press 'q' to quit", InputMode::Editing => "press 'Esc' to pause the test", }; self.print_block_of_text( diff --git a/tests/cli.rs b/tests/cli.rs index b5e887e..b4ab1c2 100644 --- a/tests/cli.rs +++ b/tests/cli.rs @@ -27,6 +27,6 @@ fn should_print_help_message_for_normal_mode() { let mut cmd = Command::cargo_bin("donkeytype").expect("Unable to get cargo bin"); cmd.assert().success().stdout(predicates::str::contains( - "press 'e' to start editing, press 'q' to quit", + "press 's' to start editing, press 'q' to quit", )); }