diff options
author | Jesse Luehrs <doy@tozt.net> | 2021-03-08 01:17:58 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2021-03-08 01:47:05 -0500 |
commit | df9656340acdcfc543d231712732a597b6ee9953 (patch) | |
tree | 066edeb7732ce8477f680f0eb1ee5edbe6453e32 /examples | |
parent | 5ec96e5d9a321a654777449bcd597ebabfaa6ffa (diff) | |
download | textmode-df9656340acdcfc543d231712732a597b6ee9953.tar.gz textmode-df9656340acdcfc543d231712732a597b6ee9953.zip |
more refactoring
Diffstat (limited to 'examples')
-rw-r--r-- | examples/tmux.rs | 18 |
1 files changed, 8 insertions, 10 deletions
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, |