diff options
author | Teddy Wing | 2016-08-05 21:07:18 -0400 |
---|---|---|
committer | Teddy Wing | 2016-08-05 21:07:18 -0400 |
commit | 8cd2204750940da38aa51f4da6a6b63410cd3f23 (patch) | |
tree | f12454f5813cf34a51c8b0239b4568c8df8a45e9 | |
parent | c2f21c2bf2b23e345d997e0f475ced0a75602577 (diff) | |
download | Passextract-8cd2204750940da38aa51f4da6a6b63410cd3f23.tar.bz2 |
Test terminal output
Output a single string to the terminal in the alternate screen. This
allows us to test the base functionality of what we'll need for a dialog
a la URLView.
Used Rustty's examples as a big reference.
-rw-r--r-- | src/main.rs | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index e7a11a9..a732c22 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,28 @@ +extern crate rustty; + +use rustty::{Terminal, Event}; +use rustty::ui::Painter; + +use std::time::Duration; + fn main() { - println!("Hello, world!"); + let mut term = Terminal::new().unwrap(); + term.swap_buffers().unwrap(); + + loop { + term.printline(0, 0, "booyakacha"); + + let evt = term.get_event(Duration::from_millis(100)).unwrap(); + if let Some(Event::Key(ch)) = evt { + match ch { + 'q' => { + break; + } + c @ _ => { + } + } + } + + term.swap_buffers().unwrap(); + } } |