windows: Properly handle dead char (#30629)

Release Notes:

- N/A
This commit is contained in:
张小白 2025-05-13 20:50:21 +08:00 committed by GitHub
parent 85c6a3dd0c
commit 7aabbb0426
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -89,6 +89,7 @@ pub(crate) fn handle_msg(
WM_KEYDOWN => handle_keydown_msg(wparam, lparam, state_ptr),
WM_KEYUP => handle_keyup_msg(wparam, state_ptr),
WM_CHAR => handle_char_msg(wparam, lparam, state_ptr),
WM_DEADCHAR => handle_dead_char_msg(wparam, state_ptr),
WM_IME_STARTCOMPOSITION => handle_ime_position(handle, state_ptr),
WM_IME_COMPOSITION => handle_ime_composition(handle, lparam, state_ptr),
WM_SETCURSOR => handle_set_cursor(lparam, state_ptr),
@ -512,6 +513,14 @@ fn handle_char_msg(
Some(0)
}
fn handle_dead_char_msg(wparam: WPARAM, state_ptr: Rc<WindowsWindowStatePtr>) -> Option<isize> {
let ch = char::from_u32(wparam.0 as u32)?.to_string();
with_input_handler(&state_ptr, |input_handler| {
input_handler.replace_and_mark_text_in_range(None, &ch, None);
});
None
}
fn handle_mouse_down_msg(
handle: HWND,
button: MouseButton,