Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More shortcuts #20

Merged
merged 2 commits into from
Apr 7, 2022
Merged

More shortcuts #20

merged 2 commits into from
Apr 7, 2022

Conversation

Samyak2
Copy link
Owner

@Samyak2 Samyak2 commented Apr 5, 2022

Changes

Added keyboard shortcuts:

  • ctrl-r: restart the typing test
  • ctrl-w: delete the last word
  • ctrl-c: exit directly (without going to results screen)

Issues fixed

Fixes #15, fixes #16, fixes #18

Added a new enum `TestStatus` that lives inside `Toipe::test`:
- stores the status of the test - whether to continue, restart, exit or
  show results - after a key press
- has helper methods to know when to continue, show results and when to
  restart
- used this as the result type of process_key instead of a boolean
  (would have been a bunch of bools without this)
- used this to determine whether to show results, to restart or to look
  for more key presses

Added 2 more shortcuts:
- ctrl-r to restart test (refreshes the words too)
    - fixes #16
- ctrl-w to delete the last word
    - fixes #18

ctrl-c now exits directly instead of showing the results screen. This
fixes #15.
Display keyboard shortcuts at the bottom of the typing test screen. Also
moved shortcuts to the bottom on the results screen.
- Added a helper function `display_lines_bottom` for displaying stuff
  at the bottom of the screen (currently used only to display
  shortcuts).
- only two shortcuts are displayed here.

Documented all keyboard shortcuts in the about section of the CLI help
page. Also added a section for this in the README.

Also modified Cargo.toml's description - removed "tux"
@Samyak2 Samyak2 added the enhancement New feature or request label Apr 5, 2022
@Samyak2 Samyak2 merged commit 7c81974 into main Apr 7, 2022
@Samyak2 Samyak2 deleted the more-shortcuts branch April 7, 2022 06:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add shortcut for deleting the last word Be able to restart/quit during typing test Minor bug
1 participant