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 { diff --git a/crates/editor2/src/element.rs b/crates/editor2/src/element.rs index 3c701fc219..a2cbb72141 100644 --- a/crates/editor2/src/element.rs +++ b/crates/editor2/src/element.rs @@ -1594,7 +1594,7 @@ impl EditorElement { &mut self, editor: &mut Editor, cx: &mut ViewContext<'_, Editor>, - bounds: Bounds, + mut bounds: Bounds, ) -> LayoutState { // let mut size = constraint.max; // if size.x.is_infinite() { @@ -1672,8 +1672,7 @@ impl EditorElement { // .min(line_height * max_lines as f32), // ) } else if let EditorMode::SingleLine = editor_mode { - todo!() - // size.set_y(line_height.max(constraint.min_along(Axis::Vertical))) + bounds.size.height = line_height.min(bounds.size.height); } // todo!() // else if size.y.is_infinite() {