From 5b0a6dddaa230f14ef076a0543dcda8934097a86 Mon Sep 17 00:00:00 2001 From: = <=> Date: Tue, 21 Aug 2018 18:22:22 +0200 Subject: [PATCH] bug fixe --- Cargo.toml | 2 +- examples/examples.rs | 18 +++++++++--------- examples/program_examples/command_bar.rs | 4 ++-- src/common/functions.rs | 2 +- src/common/screen/screen.rs | 1 + 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e7cc739..c83d705 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ readme = "README.md" winapi = { version = "0.3.5", features = ["winbase","winuser","consoleapi","processenv","wincon", "handleapi"] } [target.'cfg(unix)'.dependencies] -libc = "0.2.43" +libc = "0.2.37" termios = "0.3.0" [lib] diff --git a/examples/examples.rs b/examples/examples.rs index 03b54b4..da9c605 100644 --- a/examples/examples.rs +++ b/examples/examples.rs @@ -19,15 +19,15 @@ use std::io::Write; fn main() { - use crossterm::screen::RawScreen; - use crossterm::Screen; - - let mut screen = Screen::new(true); - - write!(screen, "text \n\r"); - let a = screen.enable_alternate_modes(true).unwrap(); - - write!(a, "text \n\r"); +// use crossterm::screen::RawScreen; +// use crossterm::Screen; +// +// let mut screen = Screen::new(true); +// +// write!(screen, "text \n\r"); +// let a = screen.enable_alternate_modes(true).unwrap(); +// +// write!(a, "text \n\r"); } diff --git a/examples/program_examples/command_bar.rs b/examples/program_examples/command_bar.rs index 0ebe9a6..c0a2d0c 100644 --- a/examples/program_examples/command_bar.rs +++ b/examples/program_examples/command_bar.rs @@ -32,7 +32,7 @@ fn main() { let a = stdin.next(); match a { - Some(Ok(b'\r')) => + Some(Ok(13)) => { input_buf.lock().unwrap().clear(); @@ -69,7 +69,7 @@ fn log(input_buf: Arc>) -> Vec> let join = thread::spawn( move || { - let crossterm = Crossterm::new(&Screen::default()); + let crossterm = Crossterm::new(&Screen::new(true)); let cursor = crossterm.cursor(); let terminal = crossterm.terminal(); diff --git a/src/common/functions.rs b/src/common/functions.rs index bd8b15d..aa93ae8 100644 --- a/src/common/functions.rs +++ b/src/common/functions.rs @@ -44,7 +44,7 @@ pub fn get_module(winapi_impl: T, unix_impl: T) -> Option { does_support = try_enable_ansi_support(); // uncomment this line when you want to use the winapi implementation. -// does_support = true; + does_support = true; if !does_support { term = Some(winapi_impl); } diff --git a/src/common/screen/screen.rs b/src/common/screen/screen.rs index fd0099c..cba31d0 100644 --- a/src/common/screen/screen.rs +++ b/src/common/screen/screen.rs @@ -56,6 +56,7 @@ impl Screen if raw_mode { let screen = Screen { stdout: Arc::new(TerminalOutput::new()), buffer: Vec::new() }; + RawScreen::into_raw_mode(); return screen; }