Make chat message list fill the available space
This commit is contained in:
@@ -345,7 +345,7 @@ impl ChatPanel {
|
|||||||
|
|
||||||
fn render_active_channel_messages(&self, _cx: &mut ViewContext<Self>) -> AnyElement {
|
fn render_active_channel_messages(&self, _cx: &mut ViewContext<Self>) -> AnyElement {
|
||||||
if self.active_chat.is_some() {
|
if self.active_chat.is_some() {
|
||||||
list(self.message_list.clone()).into_any_element()
|
list(self.message_list.clone()).full().into_any_element()
|
||||||
} else {
|
} else {
|
||||||
div().into_any_element()
|
div().into_any_element()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
px, AnyElement, AvailableSpace, BorrowAppContext, DispatchPhase, Element, IntoElement, Pixels,
|
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 collections::VecDeque;
|
||||||
|
use refineable::Refineable as _;
|
||||||
use std::{cell::RefCell, ops::Range, rc::Rc};
|
use std::{cell::RefCell, ops::Range, rc::Rc};
|
||||||
use sum_tree::{Bias, SumTree};
|
use sum_tree::{Bias, SumTree};
|
||||||
|
|
||||||
@@ -247,7 +248,8 @@ impl Element for List {
|
|||||||
_state: Option<Self::State>,
|
_state: Option<Self::State>,
|
||||||
cx: &mut crate::WindowContext,
|
cx: &mut crate::WindowContext,
|
||||||
) -> (crate::LayoutId, Self::State) {
|
) -> (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| {
|
let layout_id = cx.with_text_style(style.text_style().cloned(), |cx| {
|
||||||
cx.request_layout(&style, None)
|
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 {
|
impl sum_tree::Item for ListItem {
|
||||||
type Summary = ListItemSummary;
|
type Summary = ListItemSummary;
|
||||||
|
|
||||||
|
|||||||
@@ -74,12 +74,9 @@ pub use util::arc_cow::ArcCow;
|
|||||||
pub use view::*;
|
pub use view::*;
|
||||||
pub use window::*;
|
pub use window::*;
|
||||||
|
|
||||||
use derive_more::{Deref, DerefMut};
|
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
use std::{
|
use std::{
|
||||||
any::{Any, TypeId},
|
any::{Any, TypeId},
|
||||||
borrow::{Borrow, BorrowMut},
|
borrow::BorrowMut,
|
||||||
sync::Arc,
|
|
||||||
};
|
};
|
||||||
use taffy::TaffyLayoutEngine;
|
use taffy::TaffyLayoutEngine;
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ pub struct Mention {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl RichText {
|
impl RichText {
|
||||||
pub fn element(&self, cx: &mut WindowContext) -> AnyElement {
|
pub fn element(&self, _cx: &mut WindowContext) -> AnyElement {
|
||||||
todo!();
|
todo!();
|
||||||
|
|
||||||
// let mut region_id = 0;
|
// let mut region_id = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user