-
Notifications
You must be signed in to change notification settings - Fork 411
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
Characters from keys with modifiers are ignored in input fields #1534
Comments
Please apply this patch and build Yazi in debug mode, then check the log file to see what key was reported --- yazi/yazi-fm/src/app/app.rs
+++ yazi/yazi-fm/src/app/app_new.rs
@@ -81,7 +81,10 @@
fn dispatch_render(&mut self) { NEED_RENDER.store(true, Ordering::Relaxed); }
#[inline]
- fn dispatch_key(&mut self, key: KeyEvent) { Router::new(self).route(Key::from(key)); }
+ fn dispatch_key(&mut self, key: KeyEvent) {
+ tracing::error!(?key);
+ Router::new(self).route(Key::from(key));
+ }
#[inline]
fn dispatch_paste(&mut self, str: String) { |
From the logs:
From the source code:
|
Based on the logs, it seems that crossterm reported an incorrect key event. The I don't think there's anything Yazi can do about this, as Yazi simply receives the events from crossterm as they are without any additional processing, I suggest reporting this issue to crossterm so their devs can investigate it further. |
Hey there - @sxyazi. To help avoid users adding more issues on the crossterm repo about keyboard bindings, there's a central issue for these at crossterm-rs/crossterm#685. That issue contains debugging and more information about what terminals support what. |
Hey @joshka, thanks for linking to the issue! It seems that the problem described there is a bit different - it's not about missing key combinations; instead, it's reporting incorrect key combinations, specifically wrong |
I think so, but I could be wrong. |
This might be wrong. Other combinations like Crossterm could handle these cases because it has a function that can return the character based on the keyboard layout. So it can determine that |
If I understand correctly, the functions of For example, pressing Note the term I mentioned, "printable characters". This means However, ❯ showkey
Type any key to see the sequence it sends.
Terminate with your shell interrupt <CTL-C=ETX> or quit <FS> character.
<CTL-A=SOH> The issue here is that I'm still unsure how to handle real |
I'm a bit confused. Are you saying that yazi/yazi-config/preset/keymap.toml Lines 234 to 244 in 69c20d4
|
Let me clarify. I used the same notation for key combinations and key events. On an english keyboard, this might be different. In that case, |
Well, this brings us back to the original issue: Yazi is unable to distinguish between them. Yazi can't tell whether the user pressed When the key event already includes If it were a printable character, it should be |
The missing thing (TIL) is that AltGr (often the right Alt key on a german keyboard layout) often gets translated to Ctrl+Alt, and is used to select the third layer of keys on a keyboard (in this case It might be possible that crossterm could detect this based on the active keyboard locale and do the same thing as the newer methods do, but it would require some pretty deep digging into the windows api stuff to understand what's right to do for this. |
I'm going to lock this issue because it has been closed for 30 days. ⏳ |
What system are you running Yazi on?
Windows
What terminal are you running Yazi in?
Powershell
yazi --debug
outputDid you try the latest nightly build to see if the problem got fixed?
No, and I'll explain why below
Describe the bug
Characters that require modifiers (like ctrl, alt) are ignored in input fields like "cd --interactive". The german keyboard layout requires modifiers for some characters. Examples are @ (ctrl+alt+q), \ (ctrl+alt+ß) and ~ (ctrl+alt++). These characters are filtered out when pasting text as well ("C:\hello" becomes "C:hello").
Minimal reproducer
Anything else?
No response
The text was updated successfully, but these errors were encountered: