This commit is contained in:
= 2018-08-21 18:22:22 +02:00
parent 33d587817e
commit 5b0a6dddaa
5 changed files with 14 additions and 13 deletions

View File

@ -15,7 +15,7 @@ readme = "README.md"
winapi = { version = "0.3.5", features = ["winbase","winuser","consoleapi","processenv","wincon", "handleapi"] } winapi = { version = "0.3.5", features = ["winbase","winuser","consoleapi","processenv","wincon", "handleapi"] }
[target.'cfg(unix)'.dependencies] [target.'cfg(unix)'.dependencies]
libc = "0.2.43" libc = "0.2.37"
termios = "0.3.0" termios = "0.3.0"
[lib] [lib]

View File

@ -19,15 +19,15 @@ use std::io::Write;
fn main() fn main()
{ {
use crossterm::screen::RawScreen; // use crossterm::screen::RawScreen;
use crossterm::Screen; // use crossterm::Screen;
//
let mut screen = Screen::new(true); // let mut screen = Screen::new(true);
//
write!(screen, "text \n\r"); // write!(screen, "text \n\r");
let a = screen.enable_alternate_modes(true).unwrap(); // let a = screen.enable_alternate_modes(true).unwrap();
//
write!(a, "text \n\r"); // write!(a, "text \n\r");
} }

View File

@ -32,7 +32,7 @@ fn main() {
let a = stdin.next(); let a = stdin.next();
match a { match a {
Some(Ok(b'\r')) => Some(Ok(13)) =>
{ {
input_buf.lock().unwrap().clear(); input_buf.lock().unwrap().clear();
@ -69,7 +69,7 @@ fn log(input_buf: Arc<Mutex<String>>) -> Vec<thread::JoinHandle<()>>
let join = thread::spawn( move || { let join = thread::spawn( move || {
let crossterm = Crossterm::new(&Screen::default()); let crossterm = Crossterm::new(&Screen::new(true));
let cursor = crossterm.cursor(); let cursor = crossterm.cursor();
let terminal = crossterm.terminal(); let terminal = crossterm.terminal();

View File

@ -44,7 +44,7 @@ pub fn get_module<T>(winapi_impl: T, unix_impl: T) -> Option<T> {
does_support = try_enable_ansi_support(); does_support = try_enable_ansi_support();
// uncomment this line when you want to use the winapi implementation. // uncomment this line when you want to use the winapi implementation.
// does_support = true; does_support = true;
if !does_support { if !does_support {
term = Some(winapi_impl); term = Some(winapi_impl);
} }

View File

@ -56,6 +56,7 @@ impl Screen
if raw_mode if raw_mode
{ {
let screen = Screen { stdout: Arc::new(TerminalOutput::new()), buffer: Vec::new() }; let screen = Screen { stdout: Arc::new(TerminalOutput::new()), buffer: Vec::new() };
RawScreen::into_raw_mode();
return screen; return screen;
} }