Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Merge branch 'main' into rename-element-traits

Antonio Scandurra3b918bfee8d4
diff --cc crates/gpui2/src/element.rs
index 5f62629265b,912329c3cb1..b18ffb8ca68
--- a/crates/gpui2/src/element.rs
+++ b/crates/gpui2/src/element.rs
@@@ -487,10 -490,10 +487,10 @@@ impl IntoElement for AnyElement
type Element = Self;
fn element_id(&self) -> Option<ElementId> {
- AnyElement::element_id(self)
+ None
}
- fn render_once(self) -> Self::Element {
+ fn into_element(self) -> Self::Element {
self
}
}
diff --cc crates/gpui2/src/elements/uniform_list.rs
index b3b99ee6803,3649727648f..1ddddf9c783
--- a/crates/gpui2/src/elements/uniform_list.rs
+++ b/crates/gpui2/src/elements/uniform_list.rs
@@@ -1,7 -1,7 +1,7 @@@
use crate::{
- point, px, size, AnyElement, AvailableSpace, Bounds, Element, ElementId, InteractiveElement,
- InteractiveElementState, Interactivity, IntoElement, LayoutId, Pixels, Point, Render, Size,
- StyleRefinement, Styled, View, ViewContext, WindowContext,
+ point, px, size, AnyElement, AvailableSpace, BorrowWindow, Bounds, ContentMask, Element,
- ElementId, InteractiveElement, InteractiveElementState, Interactivity, LayoutId, Pixels, Point,
- Render, RenderOnce, Size, StyleRefinement, Styled, View, ViewContext, WindowContext,
++ ElementId, InteractiveElement, InteractiveElementState, Interactivity, IntoElement, LayoutId,
++ Pixels, Point, Render, Size, StyleRefinement, Styled, View, ViewContext, WindowContext,
};
use smallvec::SmallVec;
use std::{cell::RefCell, cmp, ops::Range, rc::Rc};
diff --cc crates/gpui2/src/view.rs
index 02696deb8aa,c46707c7e25..f31b0ae753c
--- a/crates/gpui2/src/view.rs
+++ b/crates/gpui2/src/view.rs
@@@ -248,10 -248,10 +248,10 @@@ impl<V: 'static + Render> IntoElement f
type Element = View<V>;
fn element_id(&self) -> Option<ElementId> {
- Some(self.model.entity_id.into())
+ Some(ElementId::from_entity_id(self.model.entity_id))
}
- fn render_once(self) -> Self::Element {
+ fn into_element(self) -> Self::Element {
self
}
}
@@@ -260,10 -260,10 +260,10 @@@ impl IntoElement for AnyView
type Element = Self;
fn element_id(&self) -> Option<ElementId> {
- Some(self.model.entity_id.into())
+ Some(ElementId::from_entity_id(self.model.entity_id))
}
- fn render_once(self) -> Self::Element {
+ fn into_element(self) -> Self::Element {
self
}
}
diff --cc crates/ui2/src/components/context_menu.rs
index 9ebc62f27a8,2473bff6101..d5adaf586be
--- a/crates/ui2/src/components/context_menu.rs
+++ b/crates/ui2/src/components/context_menu.rs
@@@ -104,10 -105,10 +105,10 @@@ impl Render for ContextMenu
// .border_color(cx.theme().colors().border)
.child(
List::new().children(self.items.iter().map(|item| match item {
- ContextMenuItem::Separator(separator) => {
- separator.clone().into_any_element()
- ContextMenuItem::Separator => ListSeparator::new().render_into_any(),
++ ContextMenuItem::Separator => ListSeparator::new().into_any_element(),
+ ContextMenuItem::Header(header) => {
- ListSubHeader::new(header.clone()).render_into_any()
++ ListSubHeader::new(header.clone()).into_any_element()
}
- ContextMenuItem::Header(header) => header.clone().into_any_element(),
ContextMenuItem::Entry(entry, callback) => {
let callback = callback.clone();
let dismiss = cx.listener(|_, _, cx| cx.emit(Manager::Dismiss));
diff --cc crates/ui2/src/components/list.rs
index 2063475e5a1,7319640b9ed..a994583666e
--- a/crates/ui2/src/components/list.rs
+++ b/crates/ui2/src/components/list.rs
@@@ -399,7 -382,13 +382,13 @@@ impl RenderOnce for ListItem
}
}
+ impl ParentElement for ListItem {
+ fn children_mut(&mut self) -> &mut SmallVec<[AnyElement; 2]> {
+ &mut self.children
+ }
+ }
+
-#[derive(RenderOnce, Clone)]
+#[derive(IntoElement, Clone)]
pub struct ListSeparator;
impl ListSeparator {