aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authorTeddy Wing2016-08-05 21:07:18 -0400
committerTeddy Wing2016-08-05 21:07:18 -0400
commit8cd2204750940da38aa51f4da6a6b63410cd3f23 (patch)
treef12454f5813cf34a51c8b0239b4568c8df8a45e9 /src/main.rs
parentc2f21c2bf2b23e345d997e0f475ced0a75602577 (diff)
downloadPassextract-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.
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs27
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();
+ }
}