diff --git a/crossterm_utils/Cargo.toml b/crossterm_utils/Cargo.toml index 5f1fc95..c6808a0 100644 --- a/crossterm_utils/Cargo.toml +++ b/crossterm_utils/Cargo.toml @@ -15,4 +15,4 @@ winapi = { version = "0.3.7", features = ["wincon"] } crossterm_winapi = { path="../crossterm_winapi", version = "0.1.5"} [target.'cfg(unix)'.dependencies] -libc = "0.2.51" \ No newline at end of file +libc = "0.2.51" diff --git a/crossterm_utils/src/command.rs b/crossterm_utils/src/command.rs index 9c07b41..9624202 100644 --- a/crossterm_utils/src/command.rs +++ b/crossterm_utils/src/command.rs @@ -1,8 +1,9 @@ +use std::fmt::Display; +use std::io::Write; + #[cfg(windows)] use crate::Result; use crate::{execute, impl_display, queue, write_cout}; -use std::fmt::Display; -use std::io::Write; /// A command is an action that can be performed on the terminal. /// diff --git a/crossterm_utils/src/lib.rs b/crossterm_utils/src/lib.rs index 7bf8526..80d1790 100644 --- a/crossterm_utils/src/lib.rs +++ b/crossterm_utils/src/lib.rs @@ -5,14 +5,13 @@ extern crate libc; #[cfg(windows)] extern crate winapi; +pub use self::command::{Command, ExecutableCommand, Output, QueueableCommand}; +pub use self::error::{ErrorKind, Result}; +#[cfg(windows)] +pub use self::functions::supports_ansi; + mod command; pub mod error; mod functions; pub mod macros; pub mod sys; - -pub use self::command::{Command, ExecutableCommand, Output, QueueableCommand}; - -pub use self::error::{ErrorKind, Result}; -#[cfg(windows)] -pub use self::functions::supports_ansi; diff --git a/crossterm_utils/src/macros.rs b/crossterm_utils/src/macros.rs index 52d545b..ee4054c 100644 --- a/crossterm_utils/src/macros.rs +++ b/crossterm_utils/src/macros.rs @@ -43,13 +43,15 @@ macro_rules! write_cout { /// /// # Example /// ```rust -/// use crossterm::{queue, Clear, Goto, ClearType}; +/// /// use std::io::{Write, stdout}; /// +/// use crossterm_utils::{queue, Output}; +/// /// let mut stdout = stdout(); /// /// // will be executed when flush is called -/// queue!(stdout, Goto(5, 5), Output("5,5".to_string())); +/// queue!(stdout, Output("foo".to_string())); /// /// // some other code (no execution happening here) ... /// @@ -121,13 +123,15 @@ macro_rules! queue { /// /// # Example /// ```rust -/// use crossterm::{Clear, Goto, ClearType}; +/// use std::io::Write; +/// +/// use crossterm_utils::{execute, Output}; /// /// // will be executed directly -/// execute!(std::io::stdout(), Goto(5, 5)); +/// execute!(std::io::stdout(), Output("foo".to_string())); /// /// // will be executed directly -/// execute!(std::io::stdout(), Goto(10, 10), Clear(ClearType::CurrentLine)); +/// execute!(std::io::stdout(), Output("foo".to_string()), Output("bar".to_string())); /// ``` /// /// # Remarks diff --git a/crossterm_utils/src/sys/unix.rs b/crossterm_utils/src/sys/unix.rs index 77103b8..26f7ea9 100644 --- a/crossterm_utils/src/sys/unix.rs +++ b/crossterm_utils/src/sys/unix.rs @@ -1,9 +1,9 @@ //! This module contains all `unix` specific terminal related logic. -pub use libc::{c_int, termios as Termios}; - use std::{io, mem}; +pub use libc::{c_int, termios as Termios}; + static mut ORIGINAL_TERMINAL_MODE: Option = None; pub static mut RAW_MODE_ENABLED: bool = false; diff --git a/crossterm_utils/src/sys/winapi.rs b/crossterm_utils/src/sys/winapi.rs index b56c030..313c2c8 100644 --- a/crossterm_utils/src/sys/winapi.rs +++ b/crossterm_utils/src/sys/winapi.rs @@ -1,8 +1,10 @@ pub mod ansi { - use crossterm_winapi::ConsoleMode; use std::io; + use winapi::um::wincon::ENABLE_VIRTUAL_TERMINAL_PROCESSING; + use crossterm_winapi::ConsoleMode; + /// Toggle virtual terminal processing. /// /// This method attempts to toggle virtual terminal processing for this