Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Fix duplicate prefixes when repeating completions in Vim mode (#31818)
Arseny Kapoulkinee0b818af6236
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rsindex 8d94aec8e6d..e68220eea95 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| {