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

Duplicates all keys because key-down and key-up both trigger input #333

Closed
gavinbeatty opened this issue Apr 12, 2023 · 13 comments
Closed
Labels
area: frontend Changing how something looks area: keybinds Improvements or additions to keybinds type: bug Something isn't working

Comments

@gavinbeatty
Copy link

Describe the bug:
All key-down AND key-up events trigger input, leading to duplicates.

To Reproduce:
Press i go to into text insert mode, and another "i" will appear immediately in the input text box. Press any other key, and the key will appear on key-down AND on key-up, meaning it appears twice. This includes Backspace, so it is impossible to enter a single character, even by correcting one character at a time.

Expected behavior:
Input only detected on key-down or repeats on longpress key-down.

Screenshots:
None.

System:

  • Twitch-tui version: 2.1.0
  • Operating System: Microsoft Windows 10 Pro
  • Version: 10.0.19045 Build 19045
  • Terminal: wezterm 20230408-112425-69ae8472 (installed via scoop)
  • Terminal: windows-terminal 1.16.10261.0 (installed via scoop)
  • Shell: PowerShell 7.3.3

Additional context:
None.

@gavinbeatty
Copy link
Author

  • twitch-tui installed via cargo install twitch-tui --version "2.1.0".
  • cargo installed via rustup toolchain install stable-x86_64-pc-windows-msvc --profile minimal
  • rustup 1.25.2 (installed via scoop)

@Xithrius Xithrius added type: bug Something isn't working area: frontend Changing how something looks area: keybinds Improvements or additions to keybinds labels Apr 12, 2023
@Xithrius
Copy link
Owner

Alright. Gonna go test on my windows install to see if this is reproducible.

@gavinbeatty
Copy link
Author

Cool. Just tested that this happens with cmd.exe as well, so no need to install any terminals or shells.

@Xithrius
Copy link
Owner

Looking into crossterm, there seems to be a resolved issue with the same problem. Although I didn't find it myself at, the fix is just matching only key down.

@Xithrius
Copy link
Owner

If I was to make a branch with the fix, would you be willing to checkout said branch to see if it works properly?

@gavinbeatty
Copy link
Author

Sure, no problem, no rush.

@Xithrius
Copy link
Owner

Alright. The fix will be done.

@Xithrius
Copy link
Owner

Xithrius commented Apr 12, 2023

Just to make sure, state switching with i, ?, s, etc works but user text input does not?

Nevermind, reread. All are duplicates.

@Xithrius
Copy link
Owner

A patch has been pushed to https://github.com/Xithrius/twitch-tui/tree/fix-duplicate-keys.

@gavinbeatty
Copy link
Author

Tested and it fixes this bug. Thanks!

@Xithrius
Copy link
Owner

Very well. I'll merge this into main and make a quick release for it.

@Xithrius
Copy link
Owner

74d4240

@Xithrius
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: frontend Changing how something looks area: keybinds Improvements or additions to keybinds type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants