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.

Make chat message list fill the available space

Max Brunsfeldc73990641310
diff --git a/crates/collab_ui2/src/chat_panel.rs b/crates/collab_ui2/src/chat_panel.rs
index 73d8bd67755..4a8f255f696 100644
--- a/crates/collab_ui2/src/chat_panel.rs
+++ b/crates/collab_ui2/src/chat_panel.rs
@@ -345,7 +345,7 @@ impl ChatPanel {
fn render_active_channel_messages(&self, _cx: &mut ViewContext<Self>) -> AnyElement {
if self.active_chat.is_some() {
- list(self.message_list.clone()).into_any_element()
+ list(self.message_list.clone()).full().into_any_element()
} else {
div().into_any_element()
}
diff --git a/crates/gpui2/src/elements/list.rs b/crates/gpui2/src/elements/list.rs
index a2dcb6ed61f..ba479e1ea8f 100644
--- a/crates/gpui2/src/elements/list.rs
+++ b/crates/gpui2/src/elements/list.rs
@@ -1,8 +1,9 @@
use crate::{
px, AnyElement, AvailableSpace, BorrowAppContext, DispatchPhase, Element, IntoElement, Pixels,
- Point, ScrollWheelEvent, Size, Style, StyleRefinement, WindowContext,
+ Point, ScrollWheelEvent, Size, Style, StyleRefinement, Styled, WindowContext,
};
use collections::VecDeque;
+use refineable::Refineable as _;
use std::{cell::RefCell, ops::Range, rc::Rc};
use sum_tree::{Bias, SumTree};
@@ -247,7 +248,8 @@ impl Element for List {
_state: Option<Self::State>,
cx: &mut crate::WindowContext,
) -> (crate::LayoutId, Self::State) {
- let style = Style::from(self.style.clone());
+ let mut style = Style::default();
+ style.refine(&self.style);
let layout_id = cx.with_text_style(style.text_style().cloned(), |cx| {
cx.request_layout(&style, None)
});
@@ -419,6 +421,12 @@ impl IntoElement for List {
}
}
+impl Styled for List {
+ fn style(&mut self) -> &mut StyleRefinement {
+ &mut self.style
+ }
+}
+
impl sum_tree::Item for ListItem {
type Summary = ListItemSummary;
diff --git a/crates/gpui2/src/gpui2.rs b/crates/gpui2/src/gpui2.rs
index fedea33400f..c711d1f5a2d 100644
--- a/crates/gpui2/src/gpui2.rs
+++ b/crates/gpui2/src/gpui2.rs
@@ -74,12 +74,9 @@ pub use util::arc_cow::ArcCow;
pub use view::*;
pub use window::*;
-use derive_more::{Deref, DerefMut};
-use serde::{Deserialize, Serialize};
use std::{
any::{Any, TypeId},
- borrow::{Borrow, BorrowMut},
- sync::Arc,
+ borrow::BorrowMut,
};
use taffy::TaffyLayoutEngine;
diff --git a/crates/rich_text2/src/rich_text.rs b/crates/rich_text2/src/rich_text.rs
index fd73e95b74d..263a7f311b2 100644
--- a/crates/rich_text2/src/rich_text.rs
+++ b/crates/rich_text2/src/rich_text.rs
@@ -56,7 +56,7 @@ pub struct Mention {
}
impl RichText {
- pub fn element(&self, cx: &mut WindowContext) -> AnyElement {
+ pub fn element(&self, _cx: &mut WindowContext) -> AnyElement {
todo!();
// let mut region_id = 0;