Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Fix confusing error message
Conrad Irwinb804b25c2145
diff --git a/crates/gpui2/src/element.rs b/crates/gpui2/src/element.rsindex 2a0f557272f..8fdc17de072 100644--- a/crates/gpui2/src/element.rs+++ b/crates/gpui2/src/element.rs@@ -134,7 +134,10 @@ where.layout(state, frame_state.as_mut().unwrap(), cx);}}- _ => panic!("must call initialize before layout"),+ ElementRenderPhase::Start => panic!("must call initialize before layout"),+ ElementRenderPhase::LayoutRequested { .. } | ElementRenderPhase::Painted => {+ panic!("element rendered twice")+ }};self.phase = ElementRenderPhase::LayoutRequested {diff --git a/crates/gpui2/src/interactive.rs b/crates/gpui2/src/interactive.rsindex 0725a10aca0..84beb56ef8c 100644--- a/crates/gpui2/src/interactive.rs+++ b/crates/gpui2/src/interactive.rs@@ -397,9 +397,10 @@ pub trait ElementInteraction<V: 'static>: 'static {None}),));- let result = stateful.stateless.initialize(cx, f);- stateful.key_listeners.pop();- result++ cx.with_key_dispatch_context(stateful.dispatch_context.clone(), |cx| {+ cx.with_key_listeners(mem::take(&mut stateful.key_listeners), f)+ })})} else {let stateless = self.as_stateless_mut();