From 26bb4e54e9669b487817d09ebfa36836293d741d Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Wed, 17 Nov 2021 21:45:25 -0500 Subject: make action handling the main task --- src/readline.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/readline.rs') diff --git a/src/readline.rs b/src/readline.rs index 9713a8a..093de3d 100644 --- a/src/readline.rs +++ b/src/readline.rs @@ -22,7 +22,7 @@ impl Readline { } } - pub async fn handle_key(&mut self, key: textmode::Key) -> bool { + pub async fn handle_key(&mut self, key: textmode::Key) { match key { textmode::Key::String(s) => self.add_input(&s), textmode::Key::Char(c) => { @@ -30,7 +30,7 @@ impl Readline { } textmode::Key::Ctrl(b'c') => self.clear_input(), textmode::Key::Ctrl(b'd') => { - return true; + self.action.send(crate::action::Action::Quit).await.unwrap(); } textmode::Key::Ctrl(b'l') => { self.action @@ -55,7 +55,6 @@ impl Readline { .send(crate::action::Action::Render) .await .unwrap(); - false } pub fn lines(&self) -> usize { -- cgit v1.2.3-54-g00ecf