yet another typing test, but crab flavoured

Overview

toipe

A trusty terminal typing tester for the tux.

Usage

Install

cargo install toipe

Run typing test

toipe looks best on a nice terminal (such as Alacritty) with color and style support.

toipe

Use a different word list

By default (in versions >0.1.1), a list of top 250 English words is used and random words are selected from it.

To use the OS provided word list instead (default in versions <=0.1.1), use:

toipe -w os

Note: the OS word list varies a lot from system to system and usually has more than 100,000 words. This can lead to difficult and esoteric words appearing in the test, reducing your typing speed.

You can provide your own word list too (TODO: requirements and assumptions of wordlist):

toipe -w /path/to/word/list

License

MIT

Comments
  • Panic if can't find OS wordlist (Fixes #25)

    Panic if can't find OS wordlist (Fixes #25)

    Improve error message context if we can't read a given word list. Add a ToipeError method, with_context, that prefixes the msg with a str you pass in. Use this method in each of the cases where RawWordSelector initialization can fail when initializing Toipe, so that errors from here say "Error reading the given word list: " at the front. (Fixes #25)

    bug 
    opened by benliepert 4
  • [Suggestion] Remove debug info from release builds

    [Suggestion] Remove debug info from release builds

    Rust 1.59 introduced new feature - creating stripped binaries. Results for hello-world app (target x86_64-unknown-linux-gnu):

    $ cargo build --release
       Compiling hello-world v0.1.0 (//hello-world)
        Finished release [optimized] target(s) in 0.94s
    $ du -h target/release/hello-world
    3.6M	target/release/hello-world
    # enable here
    $ cargo build --release           
       Compiling hello-world v0.1.0 (//hello-world)
        Finished release [optimized] target(s) in 0.29s
    $ du -h target/release/hello-world
    308K	target/release/hello-world
    

    with stripping all symbol information:

    [profile.release]
    strip = true
    
    enhancement packaging 
    opened by istudyatuni 3
  • Words starting with z are most likely ignored

    Words starting with z are most likely ignored

    Clippy found a bug in: https://github.com/Samyak2/toipe/blob/3cb7e31bd5dc61f0e89c244d2f6a7a3c5580856b/src/textgen.rs#L78

    The range should have been inclusive.

    https://github.com/Samyak2/toipe/runs/8056437431?check_suite_focus=true#step:6:8

    bug 
    opened by Samyak2 2
  • Show error if terminal size is too small

    Show error if terminal size is too small

    What and why?

    If the terminal size is too small, the lines (of words) overlap with each other and the cursor starts at the last line.

    It would be nice to show an error and ask the user to maximize their window (or increase the size) to use toipe.

    How?

    termion provides terminal_size to detect the size of the terminal. The difficulty arises in selecting a good threshold for the minimum size. It can be calculated based on the config (number of words) on the fly or can be fixed.

    Context

    Suggestion from reddit: https://www.reddit.com/r/rust/comments/tvamfz/comment/i3giuga/

    bug 
    opened by Samyak2 2
  • Minor bug

    Minor bug

    I found a very minor bug (which don't influence the gameplay or anything else) in the program : If you write a single word, and then press ctrl + c, you can get like more than 2000wpm, and the program says that you took 0s for 30 words.

    bug help wanted 
    opened by DaCanneAPeche 2
  • Compress bundled wordlists

    Compress bundled wordlists

    Hey! I came across your project and figured I'd take a crack some of the issues listed. This PR should solve issue: https://github.com/Samyak2/toipe/issues/31

    To compress the bundled wordlist, I've used include-flate's flate! macro as a replacement for include_str!. This will compress the wordlists during compilation.

    Size comparison for "toipe"

    I'm currently using Arch Linux with rust stable, so your results may vary.

    • Total wordlist size: 367.3KiB (380,167 Bytes)
    • Binary size using include_str!: 1.4MiB (1,452,728 Bytes)
    • Binary size using flate!: 1.2 MiB (1,268,408 Bytes)

    I've tested both binaries and I couldn't find any performance hits (compilation & runtime).

    opened by B0ney 1
  • Add shortcut to delete previous words and show statistics of previous typing tests

    Add shortcut to delete previous words and show statistics of previous typing tests

    There are some feature, you may add to make it more usable,

    1. ctrl + backspace should delete the previous typed characters until a space is encountered.
    2. Statistics of your previous typing tests
    enhancement 
    opened by kunal1234523 1
  • not working with cusotm words list

    not working with cusotm words list

    I have a txt file 243 word and when i try to open it with topie using the -f flag it shows nothing inside the app (I'm sure about the path and i tried absolute path too)

    bug question 
    opened by SamDc73 1
  • Add shortcut for deleting the last word

    Add shortcut for deleting the last word

    What and why?

    A shortcut to delete the last typed word would be nice. ctrl-w and ctrl-backspace can be used for this.

    How?

    TODO

    Context

    Suggestion from reddit: https://www.reddit.com/r/unixporn/comments/tw84a3/comment/i3endiw/

    enhancement good first issue 
    opened by Samyak2 1
  • Refactor UI components to be more modular

    Refactor UI components to be more modular

    What?

    Currently, the terminal UI in toipe is rendered by directly writing to stdout with cursor positioning and colors provided by termion.

    Example: https://github.com/Samyak2/toipe/blob/fae300576c4f83e50ca969c588217bbd3c8cb581/src/lib.rs#L263-L271

    This code looks a bit ugly and we need to manually position items by changing the arguments given to cursor::Goto. For example, sizey / 2 - 2 means two lines above the middle line. If I want to add another line to that list and move all of them down, I need to change this part of every line.

    The cursor::Left(line.len() as u16 / 2) part positions the text in the center - this snippet is repeated for every line. What's even worse is if the text in that line includes special characters such as colors, this will not work because it will consider those hidden characters too! To get around that, I use this hack: https://github.com/Samyak2/toipe/blob/fae300576c4f83e50ca969c588217bbd3c8cb581/src/lib.rs#L285-L299

    As you can see, I need to repeat the formatting characters again in a separate string containing only them and then subtract their length from line.len() like cursor::Left((line.len() - zerowidths.len()) as u16 / 2).

    How to fix?

    Honestly, I'm not sure. I opened this issue to force myself to document the problem.

    The solution will definitely involve abstracting this UI rendering into a different module. Abstracting the cursor::Gotos is simple - take a vec/iter/slice of strings and change the y-position when printing each one such that they are approximately in the middle. cursor::Left(line.len() as u16 / 2) is easy too, as long as the given string contains single-width characters. I'm not sure how zero-width and other characters can be handled here. Perhaps this problem is solved elsewhere?

    I'm always open to suggestions!

    enhancement help wanted 
    opened by Samyak2 1
  • Close some TODOs

    Close some TODOs

    This PR closes multiple TODOs.

    The "reset cursor to whatever it was before Toipe was started." TODO is, from what I can tell, unfortunately impossible due to the limitations of escape sequences used to change the cursor shape, therefore removed. See this discussion on the neovim repo.

    opened by u32int 0
  • Handle terminal resize gracefully

    Handle terminal resize gracefully

    What?

    When the terminal is resized in the middle of a typing test, the text wraps around weirdly. A ctrl-r fixes this but it would be nice to not interrupt the test.

    Although, a terminal resize in the middle of a test might be unlikely.

    How?

    Termion, the library toipe uses for terminal rendering, doesn't seem to have an event for resizes: https://gitlab.redox-os.org/redox-os/termion/-/issues/151

    So this will be tricky to implement. I'm not sure how to do this yet

    bug 
    opened by Samyak2 0
  • Use charmbracelet/vhs to auto-generate demo image

    Use charmbracelet/vhs to auto-generate demo image

    What?

    Charm just released this: https://github.com/charmbracelet/vhs

    Generating the demo image which you see in the README is a bit of a chore, adding friction to every release. vhs can automate some of this.

    How?

    Find a way to give a static seed to toipe and then write a vhs script to automatically type the words. Convert the recording to a GIF and upload it.

    enhancement good first issue 
    opened by Samyak2 0
  • [enhancement] Resetting the cursor

    [enhancement] Resetting the cursor

    After exiting toipe, the cursor will change into cursor::SteadyBlock and I find myself having to run reset in my terminal. It would be nice if the cursor could return to its original state after exiting toipe.

    enhancement 
    opened by nate-sys 2
Releases(v0.4.1)
Owner
Samyak Sarnayak
Samyak Sarnayak
ABQ is a universal test runner that runs test suites in parallel. It’s the best tool for splitting test suites into parallel jobs locally or on CI

?? abq.build   ?? @rwx_research   ?? discord   ?? documentation ABQ is a universal test runner that runs test suites in parallel. It’s the best tool f

RWX 13 Apr 7, 2023
Terminal-based typing test.

ttyper Ttyper is a terminal-based typing test built with Rust and tui-rs. installation With Cargo: cargo install ttyper usage For usage instructions,

Max Niederman 527 Dec 17, 2022
Yay - Yet another Yogurt - An AUR Helper written in Go

Yay Yet Another Yogurt - An AUR Helper Written in Go Help translate yay: Transifex Features Advanced dependency solving PKGBUILD downloading from ABS

J Guerreiro 8.6k Jan 1, 2023
Yet another fractal generator (based on glium)

Juliabrot Yet another fractal generator. Juliabrot is a Rust application using the OpenGL Framework to render in realtime. Install Rust To download Ru

Max 2 Feb 27, 2022
Yet another package manager for Rust.

Rpip Installing. Make sure you have just (packages) installed! Once you have just installed move into the root directory (where this file is) and run

null 2 Apr 27, 2022
Yet another Codeforces cli

cf-tool-rs A Rust implement for https://github.com/xalanq/cf-tool WIP. Pull Requests / Contributions are welcomed! How to Configure? Configure File sh

Woshiluo Luo 2 May 8, 2022
Yet Another Kalman Filter Implementation. As well as Lie Theory (Lie group and algebra) on SE(3). [no_std] is supported by default.

yakf - Yet Another Kalman Filter Yet Another Kalman Filter Implementation, as well as, Lie Theory (Lie group, algebra, vector) on SO(3), SE(3), SO(2),

null 7 Dec 1, 2022
Yet another lightweight and easy to use HTTP(S) server

Raptor Web server Raptor is a HTTP server written in Rust with aims to use as little memory as possible and an easy configuration. It is built on top

Volham 5 Oct 15, 2022
Yet Another Texture Packer - a small and simple CLI application to pack multiple textures/sprites into a texture atlas/sprite sheet

YATP (Yet Another Texture Packer) A small and simple CLI application to pack multiple textures/sprites into a texture atlas/sprite sheet. Installation

Petar Petrov 2 Sep 11, 2022
Yet another sort crate, porting Golang sort package to Rust.

IndexSort IndexSort Yet another sort crate (in place), porting Golang's standard sort package to Rust. Installation [dependencies] indexsort = "0.1.0"

Al Liu 4 Sep 28, 2022
🚀 Yet another repository management with auto-attaching profiles.

?? ghr Yet another repository management with auto-attaching profiles. ?? Motivation ghq is the most famous solution to resolve stress of our reposito

Naoki Ikeguchi 29 Dec 2, 2022
Yet another phigros chart player.

prpr - P hig R os P layer, written in R ust Usage To begin with, clone the repo: git clone https://github.com/Mivik/prpr.git && cd prpr For compactnes

Mivik 6 Jan 1, 2023
⚡🦀 Yet another rust system info fetcher.

Yarsi: Yet another rust sys info fetcher ✨ Showcase requirements ?? cargo ?? install with $ curl https://sh.rustup.rs -sSf | sh installation ❤️‍?? Ya

BinaryBrainiacs 8 Jan 26, 2023
Yet another command-line chat GPT frontend written in Rust.

gpterm Yet another command-line chat GPT frontend written in Rust. Features Stream output with typing effect Store chat messages/history Context aware

Makis Christou 22 May 4, 2023
Yet another code execution engine written in Rust.

exec Yet another blazingly fast code execution engine written in Rust. Paths GET /api/v1/status GET /api/v1/runtimes POST /api/v1/execute POST /api/v1

Stefan Asandei 2 Jul 11, 2023
Nerf is (yet another) rust GUI lib

NERF Nerf is (yet another) rust GUI lib. It is heavily inspired by Flutter, and is designed to build apps that could run on any plateforms, such as wi

Eclipse 14 Jul 27, 2023
Yet another Python environment manager.

yen The easiest Python environment manager. Create virtual environments for any Python version, without needing Python pre-installed. Installation Get

Tushar Sadhwani 19 Oct 7, 2023
Build some cyber security tools in Rust :crab: :rocket:

here we're trying to write some tools for cyber security in Rust because we don't have enough community for Rust in the cyber security field soo this

Khaled Nassar 42 Nov 29, 2022
Solutions to Advent of Code 2023 in Rust! :crab:

AdventOfCode2023 ?? Solutions to AoC 2023 in Rust ?? Usage # to be able to download inputs (see fetch.sh) export AOC_SESSION=[value from session cooki

Axel Lindeberg 27 Dec 17, 2023