From 3d6c257551f974a6687626960d4e59932c874249 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 21 Jul 2022 14:39:22 +0200 Subject: [PATCH] :art: --- crates/gpui/src/platform/mac/window.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/crates/gpui/src/platform/mac/window.rs b/crates/gpui/src/platform/mac/window.rs index c8d8fe3058..d50f03b18d 100644 --- a/crates/gpui/src/platform/mac/window.rs +++ b/crates/gpui/src/platform/mac/window.rs @@ -1039,14 +1039,11 @@ extern "C" fn insert_text(this: &Object, _: Sel, text: id, replacement_range: NS input_handler.replace_text_in_range(replacement_range, text) }); } else { - let pending_key_down_event = pending_key_down_event.unwrap(); - let mut window_state_borrow = window_state.borrow_mut(); - let event_callback = window_state_borrow.event_callback.take(); - drop(window_state_borrow); - let mut handled = false; + + let event_callback = window_state.borrow_mut().event_callback.take(); if let Some(mut event_callback) = event_callback { - handled = event_callback(Event::KeyDown(pending_key_down_event)); + handled = event_callback(Event::KeyDown(pending_key_down_event.unwrap())); window_state.borrow_mut().event_callback = Some(event_callback); }