Skip to content

Commit

Permalink
use 's' instead of 'e' to start the test (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
radlinskii authored Oct 19, 2024
1 parent 5695aee commit 758e807
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<Esc>`. To resume, press `'e'` again.
To pause the test, simply press `<Esc>`. 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).

Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down
4 changes: 2 additions & 2 deletions src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion tests/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
));
}

0 comments on commit 758e807

Please sign in to comment.