diff --git a/crates/assistant2/src/assistant_panel.rs b/crates/assistant2/src/assistant_panel.rs index 85d3f6f74083afe982ce7bc377426dcb08b45d05..d50fdccd6f5f6dbd2e65e515cbab60a2633f89fb 100644 --- a/crates/assistant2/src/assistant_panel.rs +++ b/crates/assistant2/src/assistant_panel.rs @@ -30,9 +30,9 @@ use fs::Fs; use futures::StreamExt; use gpui::{ canvas, 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, + 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, }; @@ -1199,9 +1199,10 @@ impl Render for AssistantPanel { }, ) .track_scroll(scroll_handle) + .into_any_element() .draw( bounds.origin, - bounds.size, + bounds.size.map(AvailableSpace::Definite), cx, ); }) diff --git a/crates/gpui2/src/element.rs b/crates/gpui2/src/element.rs index 3901db73e05c6148b813dc3937dd42843b7bc6b7..4201123a10110f540258b8afc462aeab63b3fb1a 100644 --- a/crates/gpui2/src/element.rs +++ b/crates/gpui2/src/element.rs @@ -23,17 +23,6 @@ pub trait IntoElement: Sized { self.into_element().into_any() } - fn draw(self, origin: Point, available_space: Size, cx: &mut WindowContext) - where - T: Clone + Default + Debug + Into, - { - let element = DrawableElement { - element: Some(self.into_element()), - phase: ElementDrawPhase::Start, - }; - DrawableElement::draw(element, origin, available_space.map(Into::into), cx); - } - fn draw_and_update_state( self, origin: Point, diff --git a/crates/terminal_view2/src/terminal_element.rs b/crates/terminal_view2/src/terminal_element.rs index 3b7b32dd6f609a2dc22668805cfa8adeda27bae0..ec1e1736c31a3ab24911c83f46d2edf734a2b2eb 100644 --- a/crates/terminal_view2/src/terminal_element.rs +++ b/crates/terminal_view2/src/terminal_element.rs @@ -1,11 +1,11 @@ use editor::{Cursor, HighlightedRange, HighlightedRangeLine}; use gpui::{ - black, div, fill, point, px, red, relative, AnyElement, AsyncWindowContext, BorrowWindow, - Bounds, DispatchPhase, Element, ElementId, ExternalPaths, FocusHandle, Font, FontStyle, - FontWeight, HighlightStyle, Hsla, InteractiveElement, InteractiveElementState, Interactivity, - IntoElement, LayoutId, Model, ModelContext, ModifiersChangedEvent, MouseButton, Pixels, - PlatformInputHandler, Point, Rgba, ShapedLine, StatefulInteractiveElement, Styled, TextRun, - TextStyle, TextSystem, UnderlineStyle, WhiteSpace, WindowContext, + black, div, fill, point, px, red, relative, AnyElement, AsyncWindowContext, AvailableSpace, + BorrowWindow, Bounds, DispatchPhase, Element, ElementId, ExternalPaths, FocusHandle, Font, + FontStyle, FontWeight, HighlightStyle, Hsla, InteractiveElement, InteractiveElementState, + Interactivity, IntoElement, LayoutId, Model, ModelContext, ModifiersChangedEvent, MouseButton, + Pixels, PlatformInputHandler, Point, Rgba, ShapedLine, StatefulInteractiveElement, Styled, + TextRun, TextStyle, TextSystem, UnderlineStyle, WhiteSpace, WindowContext, }; use itertools::Itertools; use language::CursorShape; @@ -854,8 +854,8 @@ impl Element for TerminalElement { }); } - if let Some(element) = layout.hyperlink_tooltip.take() { - element.draw(origin, bounds.size, cx) + if let Some(mut element) = layout.hyperlink_tooltip.take() { + element.draw(origin, bounds.size.map(AvailableSpace::Definite), cx) } }); }