commit
a516c3be05
3 changed files with 33 additions and 23 deletions
|
@ -29,12 +29,12 @@ use editor::{
|
||||||
use fs::Fs;
|
use fs::Fs;
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
div, point, relative, rems, uniform_list, Action, AnyElement, AppContext, AsyncWindowContext,
|
canvas, div, point, relative, rems, uniform_list, Action, AnyElement, AppContext,
|
||||||
ClipboardItem, Context, Div, EventEmitter, FocusHandle, Focusable, FocusableView, FontStyle,
|
AsyncWindowContext, AvailableSpace, ClipboardItem, Context, Div, EventEmitter, FocusHandle,
|
||||||
FontWeight, HighlightStyle, InteractiveElement, IntoElement, Model, ModelContext,
|
Focusable, FocusableView, FontStyle, FontWeight, HighlightStyle, InteractiveElement,
|
||||||
ParentElement, Pixels, PromptLevel, Render, SharedString, StatefulInteractiveElement, Styled,
|
IntoElement, Model, ModelContext, ParentElement, Pixels, PromptLevel, Render, SharedString,
|
||||||
Subscription, Task, TextStyle, UniformListScrollHandle, View, ViewContext, VisualContext,
|
StatefulInteractiveElement, Styled, Subscription, Task, TextStyle, UniformListScrollHandle,
|
||||||
WeakModel, WeakView, WhiteSpace, WindowContext,
|
View, ViewContext, VisualContext, WeakModel, WeakView, WhiteSpace, WindowContext,
|
||||||
};
|
};
|
||||||
use language::{language_settings::SoftWrap, Buffer, LanguageRegistry, ToOffset as _};
|
use language::{language_settings::SoftWrap, Buffer, LanguageRegistry, ToOffset as _};
|
||||||
use project::Project;
|
use project::Project;
|
||||||
|
@ -1184,17 +1184,29 @@ impl Render for AssistantPanel {
|
||||||
.child(if let Some(editor) = self.active_editor() {
|
.child(if let Some(editor) = self.active_editor() {
|
||||||
editor.clone().into_any_element()
|
editor.clone().into_any_element()
|
||||||
} else {
|
} else {
|
||||||
uniform_list(
|
let view = cx.view().clone();
|
||||||
cx.view().clone(),
|
let scroll_handle = self.saved_conversations_scroll_handle.clone();
|
||||||
"saved_conversations",
|
let conversation_count = self.saved_conversations.len();
|
||||||
self.saved_conversations.len(),
|
canvas(move |bounds, cx| {
|
||||||
|this, range, cx| {
|
uniform_list(
|
||||||
range
|
view,
|
||||||
.map(|ix| this.render_saved_conversation(ix, cx))
|
"saved_conversations",
|
||||||
.collect()
|
conversation_count,
|
||||||
},
|
|this, range, cx| {
|
||||||
)
|
range
|
||||||
.track_scroll(self.saved_conversations_scroll_handle.clone())
|
.map(|ix| this.render_saved_conversation(ix, cx))
|
||||||
|
.collect()
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.track_scroll(scroll_handle)
|
||||||
|
.into_any_element()
|
||||||
|
.draw(
|
||||||
|
bounds.origin,
|
||||||
|
bounds.size.map(AvailableSpace::Definite),
|
||||||
|
cx,
|
||||||
|
);
|
||||||
|
})
|
||||||
|
.size_full()
|
||||||
.into_any_element()
|
.into_any_element()
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
|
@ -1472,7 +1472,7 @@ impl Interactivity {
|
||||||
{
|
{
|
||||||
let mut scroll_offset = scroll_offset.borrow_mut();
|
let mut scroll_offset = scroll_offset.borrow_mut();
|
||||||
scroll_offset.x = scroll_offset.x.clamp(-scroll_max.width, px(0.));
|
scroll_offset.x = scroll_offset.x.clamp(-scroll_max.width, px(0.));
|
||||||
scroll_offset.y = scroll_offset.x.clamp(-scroll_max.height, px(0.));
|
scroll_offset.y = scroll_offset.y.clamp(-scroll_max.height, px(0.));
|
||||||
}
|
}
|
||||||
|
|
||||||
let interactive_bounds = interactive_bounds.clone();
|
let interactive_bounds = interactive_bounds.clone();
|
||||||
|
|
|
@ -4,8 +4,8 @@ use gpui::{
|
||||||
BorrowWindow, Bounds, DispatchPhase, Element, ElementId, ExternalPaths, FocusHandle, Font,
|
BorrowWindow, Bounds, DispatchPhase, Element, ElementId, ExternalPaths, FocusHandle, Font,
|
||||||
FontStyle, FontWeight, HighlightStyle, Hsla, InteractiveElement, InteractiveElementState,
|
FontStyle, FontWeight, HighlightStyle, Hsla, InteractiveElement, InteractiveElementState,
|
||||||
Interactivity, IntoElement, LayoutId, Model, ModelContext, ModifiersChangedEvent, MouseButton,
|
Interactivity, IntoElement, LayoutId, Model, ModelContext, ModifiersChangedEvent, MouseButton,
|
||||||
Pixels, PlatformInputHandler, Point, Rgba, ShapedLine, Size, StatefulInteractiveElement,
|
Pixels, PlatformInputHandler, Point, Rgba, ShapedLine, StatefulInteractiveElement, Styled,
|
||||||
Styled, TextRun, TextStyle, TextSystem, UnderlineStyle, WhiteSpace, WindowContext,
|
TextRun, TextStyle, TextSystem, UnderlineStyle, WhiteSpace, WindowContext,
|
||||||
};
|
};
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use language::CursorShape;
|
use language::CursorShape;
|
||||||
|
@ -855,9 +855,7 @@ impl Element for TerminalElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(mut element) = layout.hyperlink_tooltip.take() {
|
if let Some(mut element) = layout.hyperlink_tooltip.take() {
|
||||||
let width: AvailableSpace = bounds.size.width.into();
|
element.draw(origin, bounds.size.map(AvailableSpace::Definite), cx)
|
||||||
let height: AvailableSpace = bounds.size.height.into();
|
|
||||||
element.draw(origin, Size { width, height }, cx)
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue