Make it possible to render a single line editor (#3259)
[[PR Description]] Release Notes: - (Added|Fixed|Improved) ... ([#<public_issue_number_if_exists>](https://github.com/zed-industries/community/issues/<public_issue_number_if_exists>)).
This commit is contained in:
commit
9cdfce4956
2 changed files with 9 additions and 6 deletions
|
@ -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 {
|
||||
|
|
|
@ -1595,7 +1595,7 @@ impl EditorElement {
|
|||
&mut self,
|
||||
editor: &mut Editor,
|
||||
cx: &mut ViewContext<'_, Editor>,
|
||||
bounds: Bounds<Pixels>,
|
||||
mut bounds: Bounds<Pixels>,
|
||||
) -> LayoutState {
|
||||
// let mut size = constraint.max;
|
||||
// if size.x.is_infinite() {
|
||||
|
@ -1673,8 +1673,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() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue