From 8cd2204750940da38aa51f4da6a6b63410cd3f23 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Fri, 5 Aug 2016 21:07:18 -0400 Subject: 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. --- src/main.rs | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'src') 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(); + } } -- cgit v1.2.3