Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Checkpoint
Antonio Scandurrac3a917f8b3fa
diff --git a/crates/gpui3/src/elements/div.rs b/crates/gpui3/src/elements/div.rsindex bef0478e7fa..b2fe20530dd 100644--- a/crates/gpui3/src/elements/div.rs+++ b/crates/gpui3/src/elements/div.rs@@ -2,7 +2,7 @@ use crate::{AnyElement, BorrowWindow, Bounds, Element, ElementFocus, ElementId, ElementInteraction,FocusDisabled, FocusEnabled, FocusHandle, FocusListeners, Focusable, GlobalElementId,GroupBounds, InteractiveElementState, IntoAnyElement, LayoutId, Overflow, ParentElement,- Pixels, Point, SharedString, StatefulInteractive, StatefulInteractivity, StatelessInteraction,+ Pixels, Point, SharedString, StatefulInteraction, StatefulInteractive, StatelessInteraction,StatelessInteractive, Style, StyleRefinement, Styled, ViewContext,};use parking_lot::Mutex;@@ -61,7 +61,7 @@ whereF: ElementFocus<V>,V: 'static + Send + Sync,{- pub fn id(self, id: impl Into<ElementId>) -> Div<V, StatefulInteractivity<V>, F> {+ pub fn id(self, id: impl Into<ElementId>) -> Div<V, StatefulInteraction<V>, F> {Div {interaction: id.into().into(),focus: self.focus,@@ -331,12 +331,12 @@ where}}-impl<V, F> StatefulInteractive for Div<V, StatefulInteractivity<V>, F>+impl<V, F> StatefulInteractive for Div<V, StatefulInteraction<V>, F>whereF: ElementFocus<V>,V: 'static + Send + Sync,{- fn stateful_interactivity(&mut self) -> &mut StatefulInteractivity<Self::ViewState> {+ fn stateful_interactivity(&mut self) -> &mut StatefulInteraction<Self::ViewState> {&mut self.interaction}}diff --git a/crates/gpui3/src/elements/img.rs b/crates/gpui3/src/elements/img.rsindex ff00d40a58b..27312631363 100644--- a/crates/gpui3/src/elements/img.rs+++ b/crates/gpui3/src/elements/img.rs@@ -1,8 +1,8 @@use crate::{div, AnyElement, BorrowWindow, Bounds, Div, Element, ElementFocus, ElementId,ElementInteraction, FocusDisabled, FocusEnabled, FocusListeners, Focusable,- InteractiveElementState, IntoAnyElement, LayoutId, Pixels, SharedString, StatefulInteractive,- StatefulInteractivity, StatelessInteraction, StatelessInteractive, StyleRefinement, Styled,+ InteractiveElementState, IntoAnyElement, LayoutId, Pixels, SharedString, StatefulInteraction,+ StatefulInteractive, StatelessInteraction, StatelessInteractive, StyleRefinement, Styled,ViewContext,};use futures::FutureExt;@@ -51,7 +51,7 @@ whereV: 'static + Send + Sync,F: ElementFocus<V>,{- pub fn id(self, id: impl Into<ElementId>) -> Img<V, StatefulInteractivity<V>, F> {+ pub fn id(self, id: impl Into<ElementId>) -> Img<V, StatefulInteraction<V>, F> {Img {base: self.base.id(id),uri: self.uri,@@ -162,12 +162,12 @@ where}}-impl<V, F> StatefulInteractive for Img<V, StatefulInteractivity<V>, F>+impl<V, F> StatefulInteractive for Img<V, StatefulInteraction<V>, F>whereV: 'static + Send + Sync,F: ElementFocus<V>,{- fn stateful_interactivity(&mut self) -> &mut StatefulInteractivity<Self::ViewState> {+ fn stateful_interactivity(&mut self) -> &mut StatefulInteraction<Self::ViewState> {self.base.stateful_interactivity()}}diff --git a/crates/gpui3/src/elements/svg.rs b/crates/gpui3/src/elements/svg.rsindex 941ad5a5293..d59c1b8f04d 100644--- a/crates/gpui3/src/elements/svg.rs+++ b/crates/gpui3/src/elements/svg.rs@@ -1,7 +1,7 @@use crate::{div, AnyElement, Bounds, Div, Element, ElementFocus, ElementId, ElementInteraction,FocusDisabled, FocusEnabled, FocusListeners, Focusable, InteractiveElementState,- IntoAnyElement, LayoutId, Pixels, SharedString, StatefulInteractive, StatefulInteractivity,+ IntoAnyElement, LayoutId, Pixels, SharedString, StatefulInteraction, StatefulInteractive,StatelessInteraction, StatelessInteractive, StyleRefinement, Styled, ViewContext,};use util::ResultExt;@@ -42,7 +42,7 @@ whereV: 'static + Send + Sync,F: ElementFocus<V>,{- pub fn id(self, id: impl Into<ElementId>) -> Svg<V, StatefulInteractivity<V>, F> {+ pub fn id(self, id: impl Into<ElementId>) -> Svg<V, StatefulInteraction<V>, F> {Svg {base: self.base.id(id),path: self.path,@@ -135,12 +135,12 @@ where}}-impl<V, F> StatefulInteractive for Svg<V, StatefulInteractivity<V>, F>+impl<V, F> StatefulInteractive for Svg<V, StatefulInteraction<V>, F>whereV: 'static + Send + Sync,F: ElementFocus<V>,{- fn stateful_interactivity(&mut self) -> &mut StatefulInteractivity<Self::ViewState> {+ fn stateful_interactivity(&mut self) -> &mut StatefulInteraction<Self::ViewState> {self.base.stateful_interactivity()}}diff --git a/crates/gpui3/src/interactive.rs b/crates/gpui3/src/interactive.rsindex 4cf0e3f0148..d5c5239934f 100644--- a/crates/gpui3/src/interactive.rs+++ b/crates/gpui3/src/interactive.rs@@ -176,14 +176,10 @@ pub trait StatelessInteractive: Element {self}- fn on_key_down(+ fn on_action<A: 'static>(mut self,- listener: impl Fn(- &mut Self::ViewState,- &KeyDownEvent,- DispatchPhase,- &mut ViewContext<Self::ViewState>,- ) + Send+ listener: impl Fn(&mut Self::ViewState, &A, DispatchPhase, &mut ViewContext<Self::ViewState>)+ + Send+ Sync+ 'static,) -> Self@@ -191,7 +187,7 @@ pub trait StatelessInteractive: Element {Self: Sized,{self.stateless_interactivity().key_listeners.push((- TypeId::of::<KeyDownEvent>(),+ TypeId::of::<A>(),Arc::new(move |view, event, _, phase, cx| {let event = event.downcast_ref().unwrap();listener(view, event, phase, cx);@@ -201,10 +197,14 @@ pub trait StatelessInteractive: Element {self}- fn on_action<A: 'static>(+ fn on_key_down(mut self,- listener: impl Fn(&mut Self::ViewState, &A, DispatchPhase, &mut ViewContext<Self::ViewState>)- + Send+ listener: impl Fn(+ &mut Self::ViewState,+ &KeyDownEvent,+ DispatchPhase,+ &mut ViewContext<Self::ViewState>,+ ) + Send+ Sync+ 'static,) -> Self@@ -212,7 +212,7 @@ pub trait StatelessInteractive: Element {Self: Sized,{self.stateless_interactivity().key_listeners.push((- TypeId::of::<A>(),+ TypeId::of::<KeyDownEvent>(),Arc::new(move |view, event, _, phase, cx| {let event = event.downcast_ref().unwrap();listener(view, event, phase, cx);@@ -245,7 +245,7 @@ pub trait StatelessInteractive: Element {}pub trait StatefulInteractive: StatelessInteractive {- fn stateful_interactivity(&mut self) -> &mut StatefulInteractivity<Self::ViewState>;+ fn stateful_interactivity(&mut self) -> &mut StatefulInteraction<Self::ViewState>;fn active(mut self, f: impl FnOnce(StyleRefinement) -> StyleRefinement) -> Selfwhere@@ -290,8 +290,8 @@ pub trait StatefulInteractive: StatelessInteractive {pub trait ElementInteraction<V: 'static + Send + Sync>: 'static + Send + Sync {fn as_stateless(&self) -> &StatelessInteraction<V>;fn as_stateless_mut(&mut self) -> &mut StatelessInteraction<V>;- fn as_stateful(&self) -> Option<&StatefulInteractivity<V>>;- fn as_stateful_mut(&mut self) -> Option<&mut StatefulInteractivity<V>>;+ fn as_stateful(&self) -> Option<&StatefulInteraction<V>>;+ fn as_stateful_mut(&mut self) -> Option<&mut StatefulInteraction<V>>;fn initialize<R>(&mut self,@@ -472,7 +472,7 @@ where}#[derive(Deref, DerefMut)]-pub struct StatefulInteractivity<V: 'static + Send + Sync> {+pub struct StatefulInteraction<V: 'static + Send + Sync> {pub id: ElementId,#[deref]#[deref_mut]@@ -482,15 +482,15 @@ pub struct StatefulInteractivity<V: 'static + Send + Sync> {pub group_active_style: Option<GroupStyle>,}-impl<V> ElementInteraction<V> for StatefulInteractivity<V>+impl<V> ElementInteraction<V> for StatefulInteraction<V>whereV: 'static + Send + Sync,{- fn as_stateful(&self) -> Option<&StatefulInteractivity<V>> {+ fn as_stateful(&self) -> Option<&StatefulInteraction<V>> {Some(self)}- fn as_stateful_mut(&mut self) -> Option<&mut StatefulInteractivity<V>> {+ fn as_stateful_mut(&mut self) -> Option<&mut StatefulInteraction<V>> {Some(self)}@@ -503,7 +503,7 @@ where}}-impl<V> From<ElementId> for StatefulInteractivity<V>+impl<V> From<ElementId> for StatefulInteraction<V>whereV: 'static + Send + Sync,{@@ -598,11 +598,11 @@ impl<V> ElementInteraction<V> for StatelessInteraction<V>whereV: 'static + Send + Sync,{- fn as_stateful(&self) -> Option<&StatefulInteractivity<V>> {+ fn as_stateful(&self) -> Option<&StatefulInteraction<V>> {None}- fn as_stateful_mut(&mut self) -> Option<&mut StatefulInteractivity<V>> {+ fn as_stateful_mut(&mut self) -> Option<&mut StatefulInteraction<V>> {None}