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

Add nice error message for zero-length files. #78

Open
brian6932 opened this issue May 2, 2023 · 1 comment
Open

Add nice error message for zero-length files. #78

brian6932 opened this issue May 2, 2023 · 1 comment
Labels
good first issue Good for newcomers

Comments

@brian6932
Copy link
Contributor

So with c7b7717, the feature does work, however I noticed 3 issues:

  1. It seems to end early, calculating the total keypresses incorrectly
  2. When a typo is made in a word, instead of the word being turned red, the whole text becomes red
  3. Pressing esc, then r causes a panic, this should probably just restart the current prompt
    thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', src\ui.rs:98:26
    stack backtrace:
       0:     0x7ff7846c74b2 - <unknown>
       1:     0x7ff7846deaeb - <unknown>
       2:     0x7ff7846c36ca - <unknown>
       3:     0x7ff7846c71fb - <unknown>
       4:     0x7ff7846c9949 - <unknown>
       5:     0x7ff7846c95cb - <unknown>
       6:     0x7ff7846ca078 - <unknown>
       7:     0x7ff7846c9f6e - <unknown>
       8:     0x7ff7846c7e99 - <unknown>
       9:     0x7ff7846c9c20 - <unknown>
      10:     0x7ff7846f0ae5 - <unknown>
      11:     0x7ff7846f0c77 - <unknown>
      12:     0x7ff78463ec9d - <unknown>
      13:     0x7ff78463f8fe - <unknown>
      14:     0x7ff78463bc52 - <unknown>
      15:     0x7ff78462a976 - <unknown>
      16:     0x7ff78462a9a1 - <unknown>
      17:     0x7ff7846be0ce - <unknown>
      18:     0x7ff78463c8fc - <unknown>
      19:     0x7ff7846e5ae0 - <unknown>
      20:     0x7ffe279f117e - BaseThreadInitThunk
      21:     0x7ffe289042db - RtlUserThreadStart
@max-niederman
Copy link
Owner

I suspect that this is because the file is 0 words long, causing ttyper to error because it assumes there's always a current word.

I'll address this in v2 (#83), but if anyone is interesting in implementing a nice error message for this in v1, that would be a good first issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment