windows: Fix panic when deleting the last pre-edit char using Pinyin IME (#32442)

Release Notes:

- N/A
This commit is contained in:
张小白 2025-06-10 17:51:12 +08:00 committed by GitHub
parent 16853acbb1
commit 2dad48d8d9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -702,7 +702,7 @@ fn handle_ime_composition_inner(
} else {
if lparam & GCS_COMPSTR.0 > 0 {
let comp_string = parse_ime_composition_string(ctx, GCS_COMPSTR)?;
let caret_pos = (lparam & GCS_CURSORPOS.0 > 0).then(|| {
let caret_pos = (!comp_string.is_empty() && lparam & GCS_CURSORPOS.0 > 0).then(|| {
let pos = retrieve_composition_cursor_position(ctx);
pos..pos
});