On macOS, fix backspace emission on preedit clear

Fixes: d15feb5cfa (On macOS, fix empty marked text)
This commit is contained in:
Kirill Chibisov 2023-05-13 03:02:05 +03:00 committed by GitHub
parent bd9cc2a9da
commit a9e168e10d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -21,6 +21,7 @@ And please only add new entries to the top of this list, right below the `# Unre
- On Wayland, add `Window::drag_resize_window` method.
- On Wayland, drop `WINIT_WAYLAND_CSD_THEME` variable.
- Bump MSRV from `1.60` to `1.64`.
- On macOS, fix `Backspace` being emitted when clearing preedit with it.
# 0.28.5

View file

@ -50,7 +50,7 @@ impl Default for CursorState {
}
}
#[derive(Debug, Eq, PartialEq)]
#[derive(Debug, Eq, PartialEq, Clone, Copy)]
enum ImeState {
/// The IME events are disabled, so only `ReceivedCharacter` is being sent to the user.
Disabled,
@ -481,6 +481,7 @@ declare_class!(
&& !ev_mods.logo();
let characters = get_characters(event, ignore_alt_characters);
let old_ime_state = self.state.ime_state;
self.state.forward_key_to_app = false;
// The `interpretKeyEvents` function might call
@ -518,7 +519,8 @@ declare_class!(
true
}
ImeState::Preedit => true,
_ => false,
// `key_down` could result in preedit clear, so compare old and current state.
_ => old_ime_state != self.state.ime_state,
};
if !had_ime_input || self.state.forward_key_to_app {