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.

gpui: Fix a bug with Japanese romaji typing in input example (#28507)

Pavel6e28400e176a
diff --git a/crates/gpui/examples/input.rs b/crates/gpui/examples/input.rs
index 2beee18658a..2d01e3d7496 100644
--- a/crates/gpui/examples/input.rs
+++ b/crates/gpui/examples/input.rs
@@ -334,7 +334,11 @@ impl EntityInputHandler for TextInput {
self.content =
(self.content[0..range.start].to_owned() + new_text + &self.content[range.end..])
.into();
- self.marked_range = Some(range.start..range.start + new_text.len());
+ if !new_text.is_empty() {
+ self.marked_range = Some(range.start..range.start + new_text.len());
+ } else {
+ self.marked_range = None;
+ }
self.selected_range = new_selected_range_utf16
.as_ref()
.map(|range_utf16| self.range_from_utf16(range_utf16))