mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-11 13:10:54 +00:00
Repeat key problems fixed.
This commit is contained in:
parent
2f2e5506ce
commit
1f82c0c8bf
1 changed files with 0 additions and 38 deletions
|
@ -777,8 +777,6 @@ extern "C" fn handle_key_event(this: &Object, native_event: id, key_equivalent:
|
||||||
|
|
||||||
let event = unsafe { Event::from_native(native_event, Some(window_state_borrow.size().y())) };
|
let event = unsafe { Event::from_native(native_event, Some(window_state_borrow.size().y())) };
|
||||||
|
|
||||||
println!("Handle key event! {:?}", event);
|
|
||||||
|
|
||||||
if let Some(event) = event {
|
if let Some(event) = event {
|
||||||
if key_equivalent {
|
if key_equivalent {
|
||||||
window_state_borrow.performed_key_equivalent = true;
|
window_state_borrow.performed_key_equivalent = true;
|
||||||
|
@ -1202,19 +1200,11 @@ extern "C" fn insert_text(this: &Object, _: Sel, text: id, replacement_range: NS
|
||||||
window_state.borrow_mut().ime_text = Some(text.to_string());
|
window_state.borrow_mut().ime_text = Some(text.to_string());
|
||||||
window_state.borrow_mut().ime_state = ImeState::Acted;
|
window_state.borrow_mut().ime_state = ImeState::Acted;
|
||||||
|
|
||||||
//Conceptually incorrect
|
|
||||||
let is_composing =
|
let is_composing =
|
||||||
with_input_handler(this, |input_handler| input_handler.marked_text_range())
|
with_input_handler(this, |input_handler| input_handler.marked_text_range())
|
||||||
.flatten()
|
.flatten()
|
||||||
.is_some();
|
.is_some();
|
||||||
|
|
||||||
println!(
|
|
||||||
"Insert text, is_composing {}, text {}, have pending key down? {:?}",
|
|
||||||
is_composing,
|
|
||||||
&text,
|
|
||||||
&pending_key_down.is_some()
|
|
||||||
);
|
|
||||||
|
|
||||||
if is_composing || text.chars().count() > 1 || pending_key_down.is_none() {
|
if is_composing || text.chars().count() > 1 || pending_key_down.is_none() {
|
||||||
with_input_handler(this, |input_handler| {
|
with_input_handler(this, |input_handler| {
|
||||||
input_handler.replace_text_in_range(replacement_range, text)
|
input_handler.replace_text_in_range(replacement_range, text)
|
||||||
|
@ -1227,30 +1217,6 @@ extern "C" fn insert_text(this: &Object, _: Sel, text: id, replacement_range: NS
|
||||||
});
|
});
|
||||||
window_state.borrow_mut().pending_key_down = Some(pending_key_down);
|
window_state.borrow_mut().pending_key_down = Some(pending_key_down);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if let Some(mut pending_key_down) = pending_key_down {
|
|
||||||
// pending_key_down.1 = Some(InsertText {
|
|
||||||
// replacement_range,
|
|
||||||
// text: text.to_string(),
|
|
||||||
// });
|
|
||||||
// window_state.borrow_mut().pending_key_down = Some(pending_key_down);
|
|
||||||
|
|
||||||
// //Modifier key combos (˜ˆ) (success / failure)
|
|
||||||
// //Press-and-hold replacements ((hold i) 1 -> î) (success / failure)
|
|
||||||
// //Pop down chinese composition menu
|
|
||||||
// //Handwriting menu
|
|
||||||
// //Emoji Picker (😤)
|
|
||||||
|
|
||||||
// //Regression -> alt-i l only causes 'l' to be placed, instead of ˆl
|
|
||||||
// //
|
|
||||||
// }
|
|
||||||
// //If no pending key down, then handle_key_event isn't going to
|
|
||||||
// //insert the text for us. Do it ourselves
|
|
||||||
// else {
|
|
||||||
// with_input_handler(this, |input_handler| {
|
|
||||||
// input_handler.replace_text_in_range(replacement_range, text)
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1281,8 +1247,6 @@ extern "C" fn set_marked_text(
|
||||||
window_state.borrow_mut().ime_state = ImeState::Acted;
|
window_state.borrow_mut().ime_state = ImeState::Acted;
|
||||||
window_state.borrow_mut().ime_text = Some(text.to_string());
|
window_state.borrow_mut().ime_text = Some(text.to_string());
|
||||||
|
|
||||||
println!("set_marked_text({selected_range:?}, {replacement_range:?}, {text:?})");
|
|
||||||
|
|
||||||
with_input_handler(this, |input_handler| {
|
with_input_handler(this, |input_handler| {
|
||||||
input_handler.replace_and_mark_text_in_range(replacement_range, text, selected_range);
|
input_handler.replace_and_mark_text_in_range(replacement_range, text, selected_range);
|
||||||
});
|
});
|
||||||
|
@ -1297,8 +1261,6 @@ extern "C" fn unmark_text(this: &Object, _: Sel) {
|
||||||
borrow.ime_text.take();
|
borrow.ime_text.take();
|
||||||
}
|
}
|
||||||
|
|
||||||
println!("unmark_text()");
|
|
||||||
|
|
||||||
with_input_handler(this, |input_handler| input_handler.unmark_text());
|
with_input_handler(this, |input_handler| input_handler.unmark_text());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue