Merged main into ime-finalize

This commit is contained in:
Mikayla Maki 2022-08-16 22:57:07 -07:00
commit 2f2e5506ce
3 changed files with 27 additions and 51 deletions

View file

@ -1215,24 +1215,17 @@ extern "C" fn insert_text(this: &Object, _: Sel, text: id, replacement_range: NS
&pending_key_down.is_some()
);
//Handle key event is going to be returned to soon! Make sure it
//has the new text from the IME
match pending_key_down {
None | Some(_) if is_composing || text.chars().count() > 1 => {
with_input_handler(this, |input_handler| {
input_handler.replace_text_in_range(replacement_range, text)
});
}
Some(mut pending_key_down) => {
pending_key_down.1 = Some(InsertText {
replacement_range,
text: text.to_string(),
});
window_state.borrow_mut().pending_key_down = Some(pending_key_down);
}
_ => unreachable!(),
if is_composing || text.chars().count() > 1 || pending_key_down.is_none() {
with_input_handler(this, |input_handler| {
input_handler.replace_text_in_range(replacement_range, text)
});
} else {
let mut pending_key_down = pending_key_down.unwrap();
pending_key_down.1 = Some(InsertText {
replacement_range,
text: text.to_string(),
});
window_state.borrow_mut().pending_key_down = Some(pending_key_down);
}
// if let Some(mut pending_key_down) = pending_key_down {