diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 8a7df58acd..e5aad0e7d1 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -1945,6 +1945,7 @@ impl Editor { } pub fn insert(&mut self, text: &str, cx: &mut ViewContext) { + let text: Arc = text.into(); self.transact(cx, |this, cx| { let old_selections = this.local_selections::(cx); let selection_anchors = this.buffer.update(cx, |buffer, cx| { @@ -1956,7 +1957,9 @@ impl Editor { .collect::>() }; buffer.edit_with_autoindent( - old_selections.iter().map(|s| (s.start..s.end, text)), + old_selections + .iter() + .map(|s| (s.start..s.end, text.clone())), cx, ); anchors