checkpoint, no idea what's happening

This commit is contained in:
Mikayla Maki 2022-08-09 16:15:53 -07:00
parent 435360754b
commit 1044b7d7d2
2 changed files with 6 additions and 2 deletions

View file

@ -292,6 +292,7 @@ struct WindowState {
previous_modifiers_changed_event: Option<Event>, previous_modifiers_changed_event: Option<Event>,
} }
#[derive(Debug)]
struct InsertText { struct InsertText {
replacement_range: Option<Range<usize>>, replacement_range: Option<Range<usize>>,
text: String, text: String,
@ -742,6 +743,8 @@ extern "C" fn handle_key_event(this: &Object, native_event: id, key_equivalent:
let function_is_held; let function_is_held;
window_state_borrow.pending_key_down = match event { window_state_borrow.pending_key_down = match event {
Event::KeyDown(event) => { Event::KeyDown(event) => {
dbg!(&event);
let keydown = event.keystroke.clone(); let keydown = event.keystroke.clone();
// Ignore events from held-down keys after some of the initially-pressed keys // Ignore events from held-down keys after some of the initially-pressed keys
// were released. // were released.
@ -752,12 +755,12 @@ extern "C" fn handle_key_event(this: &Object, native_event: id, key_equivalent:
} else { } else {
window_state_borrow.last_fresh_keydown = Some(keydown); window_state_borrow.last_fresh_keydown = Some(keydown);
} }
function_is_held = event.keystroke.function; function_is_held = event.keystroke.function;
Some((event, None)) Some((event, None))
} }
_ => return NO, _ => return NO,
}; };
drop(window_state_borrow); drop(window_state_borrow);
if !function_is_held { if !function_is_held {
@ -782,6 +785,7 @@ extern "C" fn handle_key_event(this: &Object, native_event: id, key_equivalent:
} }
if !handled { if !handled {
println!("not handling, {:?}", insert_text);
if let Some(insert) = insert_text { if let Some(insert) = insert_text {
handled = true; handled = true;
with_input_handler(this, |input_handler| { with_input_handler(this, |input_handler| {

View file

@ -243,7 +243,7 @@ pub fn to_esc_str(keystroke: &Keystroke, mode: &TermMode) -> Option<String> {
} }
} }
None Some(keystroke.key.to_string())
} }
/// Code Modifiers /// Code Modifiers