Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

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

张小白2dad48d8d9d2
diff --git a/crates/gpui/src/platform/windows/events.rs b/crates/gpui/src/platform/windows/events.rs
index 7b0bde2d084..158b7b72696 100644
--- a/crates/gpui/src/platform/windows/events.rs
+++ b/crates/gpui/src/platform/windows/events.rs
@@ -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
});