From cba05e3942de179699201d8ea2ca2fef0f773f1a Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Mon, 23 Jul 2018 21:45:05 -0700 Subject: [PATCH] tidy up the hello program a tiny bit --- examples/hello.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/examples/hello.rs b/examples/hello.rs index ae9b11821..725618411 100644 --- a/examples/hello.rs +++ b/examples/hello.rs @@ -41,11 +41,18 @@ fn main() -> Result<(), Error> { match buf.terminal().poll_input(Blocking::Yes) { Ok(Some(input)) => match input { InputEvent::Key(KeyEvent { - key: KeyCode::Char('q'), + key: KeyCode::Escape, .. }) => { break; } + InputEvent::Key(KeyEvent { + key: KeyCode::Char(c), + .. + }) => { + buf.add_change(format!("{}", c)); + buf.flush()?; + } _ => { print!("{:?}\r\n", input); }