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.

Add text and focus to editor

Conrad Irwin5c450843a53a
diff --git a/crates/editor2/src/editor.rs b/crates/editor2/src/editor.rs
index 99de3733a16..c63c531cebd 100644
--- a/crates/editor2/src/editor.rs
+++ b/crates/editor2/src/editor.rs
@@ -8363,9 +8363,9 @@ impl Editor {
// .max_point()
// }
- // pub fn text(&self, cx: &AppContext) -> String {
- // self.buffer.read(cx).read(cx).text()
- // }
+ pub fn text(&self, cx: &AppContext) -> String {
+ self.buffer.read(cx).read(cx).text()
+ }
// pub fn set_text(&mut self, text: impl Into<Arc<str>>, cx: &mut ViewContext<Self>) {
// self.transact(cx, |this, cx| {
@@ -9185,6 +9185,10 @@ impl Editor {
// });
// supports
// }
+
+ fn focus(&self, cx: &mut WindowContext) {
+ cx.focus(&self.focus_handle)
+ }
}
pub trait CollaborationHub {