aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/editor.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/helix-term/src/editor.rs b/helix-term/src/editor.rs
index 8e5c0042..a6ee999c 100644
--- a/helix-term/src/editor.rs
+++ b/helix-term/src/editor.rs
@@ -259,7 +259,7 @@ impl Editor {
}
}
- pub async fn print_events(&mut self) {
+ pub async fn event_loop(&mut self) {
let mut reader = EventStream::new();
let keymap = keymap::default();
@@ -285,6 +285,14 @@ impl Editor {
code: KeyCode::Esc, ..
} => helix_core::commands::normal_mode(state, 1),
KeyEvent {
+ code: KeyCode::Backspace,
+ ..
+ } => helix_core::commands::delete_char_backward(state, 1),
+ KeyEvent {
+ code: KeyCode::Delete,
+ ..
+ } => helix_core::commands::delete_char_forward(state, 1),
+ KeyEvent {
code: KeyCode::Char(c),
..
} => helix_core::commands::insert_char(state, c),
@@ -320,7 +328,7 @@ impl Editor {
execute!(stdout, terminal::EnterAlternateScreen)?;
- self.print_events().await;
+ self.event_loop().await;
// reset cursor shape
write!(stdout, "\x1B[2 q");