From df9656340acdcfc543d231712732a597b6ee9953 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 8 Mar 2021 01:17:58 -0500 Subject: more refactoring --- examples/tmux.rs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'examples') diff --git a/examples/tmux.rs b/examples/tmux.rs index ac7205d..720b8c9 100644 --- a/examples/tmux.rs +++ b/examples/tmux.rs @@ -98,16 +98,14 @@ impl State { let notify = self.wevents.clone(); ex.spawn(async move { let mut waiting_for_command = false; + input.parse_utf8(false); + input.parse_meta(false); + input.parse_special_keys(false); loop { - let want_single_char = waiting_for_command; + input.parse_single(waiting_for_command); let key_input = smol::unblock(move || { - if want_single_char { - let key = input.read_key_char(); - (input, key) - } else { - let key = input.read_keys(); - (input, key) - } + let key = input.read_key(); + (input, key) }); match key_input.await { (returned_input, Ok(Some(key))) => { @@ -119,7 +117,7 @@ impl State { .await .unwrap(); } - textmode::Key::Char('c') => { + textmode::Key::Byte(b'c') => { notify .send(Event::Command( Command::NewWindow, @@ -127,7 +125,7 @@ impl State { .await .unwrap(); } - textmode::Key::Char('n') => { + textmode::Key::Byte(b'n') => { notify .send(Event::Command( Command::NextWindow, -- cgit v1.2.3-54-g00ecf