windows: Fix Japanese IME (#32153)

Fixed an issue where pressing `Escape` wouldn’t clear all pre-edit text
when using Japanese IME.


Release Notes:

- N/A
This commit is contained in:
张小白 2025-06-05 20:13:09 +08:00 committed by GitHub
parent 244d8517f1
commit c71791d64e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -679,6 +679,14 @@ fn handle_ime_composition_inner(
lparam: LPARAM,
state_ptr: Rc<WindowsWindowStatePtr>,
) -> Option<isize> {
if lparam.0 == 0 {
// Japanese IME may send this message with lparam = 0, which indicates that
// there is no composition string.
with_input_handler(&state_ptr, |input_handler| {
input_handler.replace_text_in_range(None, "");
})?;
return Some(0);
}
let mut ime_input = None;
if lparam.0 as u32 & GCS_COMPSTR.0 > 0 {
let comp_string = parse_ime_compostion_string(ctx)?;