-
Notifications
You must be signed in to change notification settings - Fork 909
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
CMD+Shift is not reported correctly on macOS #3078
Comments
Note that the alternative to |
Yeah, it looks like a bug, but given that we take the information from the macOS it could be doing this sort of reporting intentionally? There could be an issue with the way we build up the key, but most of the time we just query macOS for that stuff. |
It was reported that MacVim does it correctly neovide/neovide#1237 (comment). But they could just be converting it to uppercase manually. So, that’s probably how we would end up doing it, if this is not fixable on the winit side. |
Hm, yeah. Someone should try and see what macOS reports here. |
I've added logging to diff --git a/src/platform_impl/macos/event.rs b/src/platform_impl/macos/event.rs
index 9f13787b..505093ba 100644
--- a/src/platform_impl/macos/event.rs
+++ b/src/platform_impl/macos/event.rs
@@ -114,6 +114,10 @@ pub(crate) fn create_key_event(
is_repeat: bool,
key_override: Option<KeyCode>,
) -> KeyEvent {
+ if is_press {
+ trace!("ns_event: {ns_event:?}");
+ }
+
use ElementState::{Pressed, Released};
let state = if is_press { Pressed } else { Released }; Then tried the following keystrokes while running
It looks like |
I guess the solution here would be to use
We still need some special handling in Neovide for this, to use |
It sounds like what |
I also ran into this problem, trying to write a shortcut for zooming in with ctrl Fix coming in #3361 |
The corresponding bug in Neovide is neovide/neovide#1237
I have been wanting report this bug for quite some time now, since it has caused a pretty bad regression in Neovide, and has a big impact for some users. But unfortunately, I don't own a Mac, so it has been difficult to gather the information I need to report it.
The issue is that CMD + character reports the same text as CMD + Shift + character, the text always contains the base character. This does not play well with Vim, which assumes that you map the resulting characters, not a key + modifiers. We do know from the modifiers that shift is pressed, but that information can't really be used without knowing the keymap, it's possible to turn standard alpha keys to uppercase, but in combination with the number keys for example, we don't have any idea what character to send to Neovim.
Here's a trace captured through the Neovide logging, where
CMD+shift+d
was pressed.As, you can see, there's absolutely no way of translating this to
<D-D>
, which Neovim wants, instead of<D-d>
, other than manually detect that shift is pressed and try to convert it to uppercase, and hope that's the correct character. But as mentioned, it only deals with the alphas, and without other modifier combinations.All the other platforms report this correctly, well, they don't have CMD, but alt+shift+character, for example works correctly (except for some combinations #3012). I have no idea if alt and other combinations work correctly on macOS or not, since I have not been able to gather that information and that's why I have been waiting to create this issue before now.
Note that we are using 0.29.0-beta0, and since I can't test this myself, I haven't done any testing on beta1, but I don't see anything in the changelogs that would indicate it's fixed.
The text was updated successfully, but these errors were encountered: