@@ -29,12 +29,12 @@ use editor::{
use fs::Fs;
use futures::StreamExt;
use gpui::{
- div, point, relative, rems, uniform_list, Action, AnyElement, AppContext, AsyncWindowContext,
- ClipboardItem, Context, Div, EventEmitter, FocusHandle, Focusable, FocusableView, FontStyle,
- FontWeight, HighlightStyle, InteractiveElement, IntoElement, Model, ModelContext,
- ParentElement, Pixels, PromptLevel, Render, SharedString, StatefulInteractiveElement, Styled,
- Subscription, Task, TextStyle, UniformListScrollHandle, View, ViewContext, VisualContext,
- WeakModel, WeakView, WhiteSpace, WindowContext,
+ canvas, div, point, relative, rems, uniform_list, Action, AnyElement, AppContext,
+ AsyncWindowContext, AvailableSpace, ClipboardItem, Context, Div, EventEmitter, FocusHandle,
+ Focusable, FocusableView, FontStyle, FontWeight, HighlightStyle, InteractiveElement,
+ IntoElement, Model, ModelContext, ParentElement, Pixels, PromptLevel, Render, SharedString,
+ StatefulInteractiveElement, Styled, Subscription, Task, TextStyle, UniformListScrollHandle,
+ View, ViewContext, VisualContext, WeakModel, WeakView, WhiteSpace, WindowContext,
};
use language::{language_settings::SoftWrap, Buffer, LanguageRegistry, ToOffset as _};
use project::Project;
@@ -1184,17 +1184,28 @@ impl Render for AssistantPanel {
.child(if let Some(editor) = self.active_editor() {
editor.clone().into_any_element()
} else {
- uniform_list(
- cx.view().clone(),
- "saved_conversations",
- self.saved_conversations.len(),
- |this, range, cx| {
- range
- .map(|ix| this.render_saved_conversation(ix, cx))
- .collect()
- },
- )
- .track_scroll(self.saved_conversations_scroll_handle.clone())
+ let view = cx.view().clone();
+ let scroll_handle = self.saved_conversations_scroll_handle.clone();
+ let conversation_count = self.saved_conversations.len();
+ canvas(move |bounds, cx| {
+ uniform_list(
+ view,
+ "saved_conversations",
+ conversation_count,
+ |this, range, cx| {
+ range
+ .map(|ix| this.render_saved_conversation(ix, cx))
+ .collect()
+ },
+ )
+ .track_scroll(scroll_handle)
+ .draw(
+ bounds.origin,
+ bounds.size,
+ cx,
+ );
+ })
+ .size_full()
.into_any_element()
}),
)