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

Tracking: Missing key combinations #685

Open
3 tasks
TimonPost opened this issue Jun 30, 2022 · 17 comments
Open
3 tasks

Tracking: Missing key combinations #685

TimonPost opened this issue Jun 30, 2022 · 17 comments

Comments

@TimonPost
Copy link
Member

TimonPost commented Jun 30, 2022

Parsing ANSI codes to input events is a pain. There is no good way to tell which terminals implement which key combinations. Therefore it might occur that some terminals do support certain key presses while others dont. This issue serves as a tracking issue and lists various keys that are reported missing. Either it might be that crossterm has not yet implemented it or that the terminal doesn't support the key combination. Please post your missing keys in this issue.

How to debug

This code is responsible for parsing a bytes buffer to an event. If you miss a key, it is useful if you can print the buffer with println!("Buffer: {:?}, buffer) in this function. Then report that value with the missing keys in this issue. That way we can trace back and see if crossterm should add parsing logic for that buffer.

Reported Missing

note: not all are solved

Note

Please do not create a separate issue for missing combinations, instead comment in this issue such that I can update the above list. The above list contains combinations that might have been fixed or missing combinations that are still to be fixed.

@cloudultima3164
Copy link

cloudultima3164 commented Sep 10, 2022

@TimonPost
Sorry for the sudden comment. I was just writing up a simple tui using crossterm as a backend, and I ran into this issue. I'm not very experienced with coding, so I could be overlooking something, but it looks like the function for parsing events that you linked above never tries to match Enter with some key modifiers based on input. Again, I'm not really familiar, but could adding a few more match cases could take care of most enter-related issues?

@TimonPost
Copy link
Member Author

It depends if the terminal supports escape codes for certain special key combinations. It indeed might be the case that it can be mapped but isn't implemented yet, in that case, it's a simple addition to the existing parsing code. If you have any in mind feel free to add them.

@cloudultima3164
Copy link

cloudultima3164 commented Sep 10, 2022

@TimonPost
Thanks for the quick response! I checked this out in my local environment (I'm using fish on Pop!_OS). It looks like it's not as simple as I was hoping, and I kind of understand your concern better.
As you mentioned, I printed out the buffer, the event, and labeled what was actually pressed on the keyboard. I can now see that there probably is no way to tell that Ctrl or Shift were even pressed in these cases.

Edit: Same result using bash as well.

event_log.txt

@pianohacker
Copy link
Contributor

Can this be closed with the addition of the keyboard enhancement feature to 0.25?

That support is limited to certain terminals, but most of these are unsupportable without it.

@TimonPost
Copy link
Member Author

This issue tracks all kinds of missing key combinations so can not be closed as there are still some left

@alexzanderr
Copy link

alexzanderr commented Oct 22, 2022

i want to ask a question about Reported Missing list.

the items that dont have a todo box are considered solved (i.e. the keys are now supported and detectable), are considered not yet implemented or they cant be implemented so they are left alone in darkness?

for example

another question: they corresponding issues are closed in favor of this one, right?

note: im using

  • manjaro OS
  • alacritty terminal (also kitty, working in both of them)
  • xfce DE

@TimonPost
Copy link
Member Author

Yes, I need to go through them again and add boxes for combinations that have no solution yet. Will add a note that not all are solved.

@alexzanderr
Copy link

alexzanderr commented Oct 22, 2022

another technical question, please, is there a way to get a Vec<u8> from the unsupported keys, something like RawKey, so that maybe i can solve the problem temporarily for my code?

to at least to see what ctrl + enter does look like as bytes, for example.

cant see anything like that in the docs.

@crossterm-rs crossterm-rs deleted a comment from alexzanderr Oct 22, 2022
@crossterm-rs crossterm-rs deleted a comment from alexzanderr Oct 22, 2022
@TimonPost
Copy link
Member Author

TimonPost commented Oct 22, 2022

Please join the discord for questions like this, prefer to keep this thread short

@coastalwhite
Copy link

As mentioned in #771. Shift+Tab in the TTY is also broken. It produces Alt+Tab, it should probably produce BackShift or Shift+Tab. I am uncertain whether this is a limitation of the TTY.

@sigmaSd
Copy link
Contributor

sigmaSd commented Apr 15, 2023

Ctrl+shift+Letters only gives the modifier ctrl (unix) #719

this works in termwiz (linux) so its probably doable

@sigmaSd
Copy link
Contributor

sigmaSd commented Apr 15, 2023

@coastalwhite which terminal/os shift+tab work for me (linux/wezterm)

For anyone trying to report a bug in key combo please do:

  • test with the event-read example so cargo r --exampe event-read on this repo
  • test a terminal that supports kitty protocol on unix so wezterm/kitty (if wezterm make sure to have enable_kitty_keyboard = true)
  • mention os/terminal

@coastalwhite
Copy link

Sorry for not being entirely clear. This is purely a Linux TTY issue, it works fine in any non-TTY terminal I have tried (Alacritty, Kitty, etc.). So if you run cargo r --example event-read and press Shift+Tab it will give back:

Event: Key(KeyEvent { code: Tab, modifiers: KeyModifiers(ALT), kind: Press, state: KeyEventState(0x0) })

@Araxeus
Copy link

Araxeus commented Apr 15, 2023

just making it clear that #669 is still unresolved – shift/ctrl + enter works on Windows but not on Linux or macOS

@Xithrius
Copy link

I am unable to get Shift + Enter to register while running cargo r --example event-read in Kitty, within Linux.

@sigmaSd
Copy link
Contributor

sigmaSd commented Aug 6, 2023

Ctrl+shift+Letters only gives the modifier ctrl (unix) #719

this works in termwiz (linux) so its probably doable

turns out thiis works with the kitty protocol, in linux wezterm (with enable_kitty_keyboard=true) I have this working now ctrl+shift+letter ctrl+shift+enter

@ryan-rushton
Copy link

ryan-rushton commented Feb 24, 2024

Just reporting in with any modifier + backspace is not working as I only see the backspace key come through. Debugging I see the following

Screenshot 2024-02-25 at 9 45 14 am

System is a Macbook M1 Pro with OSX Version 14.2.1 (23C71). Using crossterm through the ratatui component template with crossterm = { version = "0.27.0", features = ["serde", "event-stream"] }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants