Make chat message list fill the available space

This commit is contained in:
Max Brunsfeld 2023-12-08 12:27:45 -08:00
parent c7d8169cab
commit c739906413
4 changed files with 13 additions and 8 deletions

View file

@ -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()
}

View file

@ -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;

View file

@ -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;

View file

@ -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;