From 5c450843a53a3b27688138a58b2befacba363e6d Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Tue, 7 Nov 2023 14:19:15 -0700 Subject: [PATCH] Add text and focus to editor --- crates/editor2/src/editor.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/crates/editor2/src/editor.rs b/crates/editor2/src/editor.rs index 99de3733a1..c63c531ceb 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>, cx: &mut ViewContext) { // 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 {