-
Notifications
You must be signed in to change notification settings - Fork 285
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
Receiving release Enter
command upon application start.
#752
Comments
Looks like this was caused by this PR: #745 and the fix is to check the if let Event::Key(key) = event {
if key.kind == KeyEventKind::Press {
...
}
} |
Thats possible, does it have the KeyEvent:::kind set? |
This bug only occurs in crossterm 0.26.0 and above (I found this issue while creating my bug, so posting my template below): To Reproduce pub fn main() {
crossterm::terminal::enable_raw_mode().unwrap();
let result = crossterm::event::read();
eprintln!("RESULT: {:?}", result);
} This will immedately return the enter key press:
Expected behavior It should wait for a key press. OS Terminal/Console Windows terminal |
I just did some testing on various terminals and shells and the incorrect enter "release" event does not appear on command prompt as long as you are using conhost instead of wezterm or windows terminal. No clue why this happens, needs to be looked in to. Powershell on conhost has the release event on launch as well. Edit: it's quite funny how command prompt on conhost is the only one that actually works perfectly with the modern input. Windows terminal is the least functional right now in terms of input microsoft/terminal#8440. |
Interesting finding! So this issue seems to have to things at play:
I think I will disable the first feature by default as its not cross platform functionality, rather only for kitty and windows at the moment. So it should likely be an opt in over an default feature. The second issue was introduced by #745 where I removed:
I wasn't sure what the purpose of this was but likely this was the reason it exited in the code. It early returns if the key was down whereafter it does a check on virtual key codes. I think it might be to do with the event press when you start the application from the command line and press enter to run the command. |
Enter
command upon application start.
Does kitty protocol actually make release events work on linux? I thought it was only used for extra modifier keys. Last time when I disabled win32 input and enabled kitty in wezterm there were no releases. |
You also have to enable the KeyboardEnhancementFlags::REPORT_EVENT_TYPES in order for the kitty protocol to fire them. And it might be that not every kitty protocol implementation has this correctly implemented. see: https://sw.kovidgoyal.net/kitty/keyboard-protocol/#key-codes |
@TimonPost It seems wezterm got it fixed just today lol wez/wezterm#3220 (comment) |
Describe the bug
We had a strange problem developing REPL for the Erg language: erg-lang/erg#362
When we run a program through the terminal, we get an Enter event first, and then whatever we type(type only once), it gets two of these input events
This bug only appears at
0.26.0
, not0.25.0
This issue only appears on Windows (not WSL)
OS
The text was updated successfully, but these errors were encountered: