macOS: Improve deadkeys (#20515)
Closes #19738 This change refactors how we handle input on macOS to avoid simulating our own IME. This fixes a number of small edge-cases, and also lets us remove a bunch of code that had been added to work around bugs in the previous version. Release Notes: - On macOS: Keyboard shortcuts are now handled before activating the IME system, this enables using vim's default mode on keyboards that use IME menus (like Japanese). - On macOS: Improvements to handling of dead-keys. For example when typing `""` on a Brazillian keyboard, you now get a committed " and a new marked ", as happens in other apps. Also, you can now type cmd-^ on an AZERTY keyboard for indent; and ^ on a QWERTZ keyboard now goes to the beginning of line in vim normal mode, or `d i "` no requires no space to delete within quotes on Brazilian keyboards (though `d f " space` is still required as `f` relies on the input handler, not a binding). - On macOS: In the terminal pane, holding down a key will now repeat that key (as happens in iTerm2) instead of opening the character selector.
This commit is contained in:
parent
38f2a919f8
commit
2ea4ede08e
8 changed files with 228 additions and 218 deletions
|
@ -683,6 +683,11 @@ impl PlatformInputHandler {
|
|||
.flatten()
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn apple_press_and_hold_enabled(&mut self) -> bool {
|
||||
self.handler.apple_press_and_hold_enabled()
|
||||
}
|
||||
|
||||
pub(crate) fn dispatch_input(&mut self, input: &str, cx: &mut WindowContext) {
|
||||
self.handler.replace_text_in_range(None, input, cx);
|
||||
}
|
||||
|
@ -780,6 +785,15 @@ pub trait InputHandler: 'static {
|
|||
range_utf16: Range<usize>,
|
||||
cx: &mut WindowContext,
|
||||
) -> Option<Bounds<Pixels>>;
|
||||
|
||||
/// Allows a given input context to opt into getting raw key repeats instead of
|
||||
/// sending these to the platform.
|
||||
/// TODO: Ideally we should be able to set ApplePressAndHoldEnabled in NSUserDefaults
|
||||
/// (which is how iTerm does it) but it doesn't seem to work for me.
|
||||
#[allow(dead_code)]
|
||||
fn apple_press_and_hold_enabled(&mut self) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
/// The variables that can be configured when creating a new window
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue