Remove input from KeyDownEvent

This commit is contained in:
Antonio Scandurra 2022-07-21 14:29:27 +02:00
parent f170582c26
commit 101a0663d3
6 changed files with 16 additions and 79 deletions

View file

@ -24,7 +24,7 @@ use gpui::{
json::{self, ToJson},
platform::CursorStyle,
text_layout::{self, Line, RunStyle, TextLayoutCache},
AppContext, Axis, Border, CursorRegion, Element, ElementBox, Event, EventContext, KeyDownEvent,
AppContext, Axis, Border, CursorRegion, Element, ElementBox, Event, EventContext,
LayoutContext, ModifiersChangedEvent, MouseButton, MouseEvent, MouseMovedEvent,
MutableAppContext, PaintContext, Quad, Scene, ScrollWheelEvent, SizeConstraint, ViewContext,
WeakViewHandle,
@ -278,21 +278,6 @@ impl EditorElement {
true
}
fn key_down(&self, input: Option<&str>, cx: &mut EventContext) -> bool {
let view = self.view.upgrade(cx.app).unwrap();
if view.is_focused(cx.app) {
if let Some(input) = input {
cx.dispatch_action(Input(input.to_string()));
true
} else {
false
}
} else {
false
}
}
fn modifiers_changed(&self, cmd: bool, cx: &mut EventContext) -> bool {
cx.dispatch_action(CmdChanged { cmd_down: cmd });
false

View file

@ -141,13 +141,7 @@ impl<'a> EditorTestContext<'a> {
pub fn simulate_keystroke(&mut self, keystroke_text: &str) {
let keystroke = Keystroke::parse(keystroke_text).unwrap();
let input = if keystroke.modified() {
None
} else {
Some(keystroke.key.clone())
};
self.cx
.dispatch_keystroke(self.window_id, keystroke, input, false);
self.cx.dispatch_keystroke(self.window_id, keystroke, false);
}
pub fn simulate_keystrokes<const COUNT: usize>(&mut self, keystroke_texts: [&str; COUNT]) {