mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-23 22:01:31 +11:00
On macOS, fix Ime::Commit
persisting
This commit clears the currently marked text on `Ime::Commit`, so normal `ReceivedCharacter` input can continue.
This commit is contained in:
parent
4e1c46fe9e
commit
3fd73848dd
|
@ -8,6 +8,7 @@ And please only add new entries to the top of this list, right below the `# Unre
|
||||||
|
|
||||||
# Unreleased
|
# Unreleased
|
||||||
|
|
||||||
|
- On macOS, fixed `Ime::Commit` persisting for all input after interacting with `Ime`.
|
||||||
- On macOS, added `WindowExtMacOS::option_as_alt` and `WindowExtMacOS::set_option_as_alt`.
|
- On macOS, added `WindowExtMacOS::option_as_alt` and `WindowExtMacOS::set_option_as_alt`.
|
||||||
- On Windows, fix window size for maximized, undecorated windows.
|
- On Windows, fix window size for maximized, undecorated windows.
|
||||||
- On Windows and macOS, add `WindowBuilder::with_active`.
|
- On Windows and macOS, add `WindowBuilder::with_active`.
|
||||||
|
|
|
@ -424,7 +424,8 @@ declare_class!(
|
||||||
|
|
||||||
let is_control = string.chars().next().map_or(false, |c| c.is_control());
|
let is_control = string.chars().next().map_or(false, |c| c.is_control());
|
||||||
|
|
||||||
if self.is_ime_enabled() && !is_control {
|
// Commit only if we have marked text.
|
||||||
|
if self.hasMarkedText() && self.is_ime_enabled() && !is_control {
|
||||||
self.queue_event(WindowEvent::Ime(Ime::Preedit(String::new(), None)));
|
self.queue_event(WindowEvent::Ime(Ime::Preedit(String::new(), None)));
|
||||||
self.queue_event(WindowEvent::Ime(Ime::Commit(string)));
|
self.queue_event(WindowEvent::Ime(Ime::Commit(string)));
|
||||||
self.state.ime_state = ImeState::Commited;
|
self.state.ime_state = ImeState::Commited;
|
||||||
|
@ -496,6 +497,8 @@ declare_class!(
|
||||||
|
|
||||||
// If the text was commited we must treat the next keyboard event as IME related.
|
// If the text was commited we must treat the next keyboard event as IME related.
|
||||||
if self.state.ime_state == ImeState::Commited {
|
if self.state.ime_state == ImeState::Commited {
|
||||||
|
// Remove any marked text, so normal input can continue.
|
||||||
|
*self.marked_text = NSMutableAttributedString::new();
|
||||||
self.state.ime_state = ImeState::Enabled;
|
self.state.ime_state = ImeState::Enabled;
|
||||||
text_commited = true;
|
text_commited = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue