tidy up the hello program a tiny bit

This commit is contained in:
Wez Furlong committed 2018-07-23 21:45:05 -07:00
1 parent 11a32f7d99
commit cba05e3942
1 file changed
+8 -1
+8 -1
View File
@@ -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);
}