Fix panicking unwrap()
This commit is contained in:
parent
bb584cc7c4
commit
b69b5742ed
4 changed files with 5 additions and 10 deletions
|
@ -32,9 +32,7 @@ pub struct CommandPalette {
|
||||||
|
|
||||||
impl CommandPalette {
|
impl CommandPalette {
|
||||||
fn register(workspace: &mut Workspace, _: &mut ViewContext<Workspace>) {
|
fn register(workspace: &mut Workspace, _: &mut ViewContext<Workspace>) {
|
||||||
dbg!("registering command palette toggle");
|
|
||||||
workspace.register_action(|workspace, _: &Toggle, cx| {
|
workspace.register_action(|workspace, _: &Toggle, cx| {
|
||||||
dbg!("got cmd-shift-p");
|
|
||||||
let Some(previous_focus_handle) = cx.focused() else {
|
let Some(previous_focus_handle) = cx.focused() else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1076,9 +1076,6 @@ where
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if !self.key_context.is_empty() {
|
|
||||||
dbg!(&self.key_context, self.action_listeners.len());
|
|
||||||
}
|
|
||||||
for (action_type, listener) in self.action_listeners.drain(..) {
|
for (action_type, listener) in self.action_listeners.drain(..) {
|
||||||
cx.on_action(action_type, listener)
|
cx.on_action(action_type, listener)
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,7 +193,11 @@ impl<V: 'static> Element<V> for UniformList<V> {
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut interactivity = mem::take(&mut self.interactivity);
|
let mut interactivity = mem::take(&mut self.interactivity);
|
||||||
let shared_scroll_offset = element_state.interactive.scroll_offset.clone().unwrap();
|
let shared_scroll_offset = element_state
|
||||||
|
.interactive
|
||||||
|
.scroll_offset
|
||||||
|
.get_or_insert_with(Arc::default)
|
||||||
|
.clone();
|
||||||
|
|
||||||
interactivity.paint(
|
interactivity.paint(
|
||||||
bounds,
|
bounds,
|
||||||
|
|
|
@ -1309,7 +1309,6 @@ impl<'a> WindowContext<'a> {
|
||||||
.current_frame
|
.current_frame
|
||||||
.dispatch_tree
|
.dispatch_tree
|
||||||
.dispatch_path(node_id);
|
.dispatch_path(node_id);
|
||||||
dbg!(node_id, &dispatch_path, self.propagate_event);
|
|
||||||
|
|
||||||
// Capture phase
|
// Capture phase
|
||||||
for node_id in &dispatch_path {
|
for node_id in &dispatch_path {
|
||||||
|
@ -1329,8 +1328,6 @@ impl<'a> WindowContext<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dbg!(node_id, &dispatch_path, self.propagate_event);
|
|
||||||
|
|
||||||
// Bubble phase
|
// Bubble phase
|
||||||
for node_id in dispatch_path.iter().rev() {
|
for node_id in dispatch_path.iter().rev() {
|
||||||
let node = self.window.current_frame.dispatch_tree.node(*node_id);
|
let node = self.window.current_frame.dispatch_tree.node(*node_id);
|
||||||
|
@ -1340,7 +1337,6 @@ impl<'a> WindowContext<'a> {
|
||||||
} in node.action_listeners.clone()
|
} in node.action_listeners.clone()
|
||||||
{
|
{
|
||||||
let any_action = action.as_any();
|
let any_action = action.as_any();
|
||||||
dbg!(action_type, any_action.type_id());
|
|
||||||
if action_type == any_action.type_id() {
|
if action_type == any_action.type_id() {
|
||||||
self.propagate_event = false; // Actions stop propagation by default during the bubble phase
|
self.propagate_event = false; // Actions stop propagation by default during the bubble phase
|
||||||
listener(any_action, DispatchPhase::Bubble, self);
|
listener(any_action, DispatchPhase::Bubble, self);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue