diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 8d94aec8e6..e68220eea9 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -5531,9 +5531,18 @@ impl Editor { } } + let mut common_prefix_len = 0; + for (a, b) in old_text.chars().zip(new_text.chars()) { + if a == b { + common_prefix_len += a.len_utf8(); + } else { + break; + } + } + cx.emit(EditorEvent::InputHandled { utf16_range_to_replace: None, - text: new_text.clone().into(), + text: new_text[common_prefix_len..].into(), }); self.transact(window, cx, |this, window, cx| {