checkpoint

This commit is contained in:
Mikayla Maki 2022-07-12 18:44:36 -07:00
parent 2ca340b9f1
commit f630ab4821
2 changed files with 23 additions and 4 deletions

View file

@ -1,5 +1,21 @@
use gpui::KeyDownEvent; use gpui::KeyDownEvent;
fn to_esc_str(event: &KeyDownEvent) -> &str { pub fn to_esc_str(event: &KeyDownEvent) -> String {
"Test" let key = event.keystroke.key.clone();
let modifiers = (
event.keystroke.alt,
event.keystroke.cmd,
event.keystroke.ctrl,
event.keystroke.shift,
);
match (key.as_str(), modifiers) {
//ctrl-l
//shift-tab
//alt-back
//shift-back
//shift + Home, end, page up, page down + NOT alt screen => We handle those
//shift + Home, end, page up, page down + alt screen => Send escape sequence
("l", (false, false, true, false)) => "\x0c".to_string(),
_ => event.input.clone().unwrap().clone(),
}
} }

View file

@ -31,7 +31,10 @@ use theme::TerminalStyle;
use std::{cmp::min, ops::Range, rc::Rc, sync::Arc}; use std::{cmp::min, ops::Range, rc::Rc, sync::Arc};
use std::{fmt::Debug, ops::Sub}; use std::{fmt::Debug, ops::Sub};
use crate::{color_translation::convert_color, ScrollTerminal, Terminal, ZedListener}; use crate::{
color_translation::convert_color, keyboard_to_esc::to_esc_str, ScrollTerminal, Terminal,
ZedListener,
};
///Scrolling is unbearably sluggish by default. Alacritty supports a configurable ///Scrolling is unbearably sluggish by default. Alacritty supports a configurable
///Scroll multiplier that is set to 3 by default. This will be removed when I ///Scroll multiplier that is set to 3 by default. This will be removed when I
@ -368,7 +371,7 @@ impl Element for TerminalEl {
dbg!(e); dbg!(e);
cx.is_parent_view_focused() cx.is_parent_view_focused()
.then(|| { .then(|| {
cx.dispatch_action(Input(input.to_string())); cx.dispatch_action(Input(to_esc_str(e)));
}) })
.is_some() .is_some()
} }