Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crossterm_utils fixes #211

Merged
merged 3 commits into from
Sep 14, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion crossterm_utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,9 @@ winapi = { version = "0.3.7", features = ["wincon"] }
crossterm_winapi = { path="../crossterm_winapi", version = "0.1.5"}

[target.'cfg(unix)'.dependencies]
libc = "0.2.51"
libc = "0.2.51"

[dev-dependencies]
crossterm_utils = { path = "../crossterm_utils" }
crossterm_cursor = { path = "../crossterm_cursor" }
crossterm_terminal = { path = "../crossterm_terminal" }
5 changes: 3 additions & 2 deletions crossterm_utils/src/command.rs
Original file line number Diff line number Diff line change
@@ -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.
///
Expand Down
11 changes: 5 additions & 6 deletions crossterm_utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
18 changes: 16 additions & 2 deletions crossterm_utils/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,15 @@ macro_rules! write_cout {
///
/// # Example
/// ```rust
/// use crossterm::{queue, Clear, Goto, ClearType};
/// extern crate crossterm_cursor;
/// extern crate crossterm_terminal;
///
/// use std::io::{Write, stdout};
///
/// use crossterm_cursor::Goto;
/// use crossterm_terminal::{Clear, ClearType};
/// use crossterm_utils::{queue, Output};
///
/// let mut stdout = stdout();
///
/// // will be executed when flush is called
Expand Down Expand Up @@ -121,7 +127,15 @@ macro_rules! queue {
///
/// # Example
/// ```rust
/// use crossterm::{Clear, Goto, ClearType};
/// extern crate crossterm_cursor;
/// extern crate crossterm_utils;
/// extern crate crossterm_terminal;
///
/// use std::io::Write;
///
/// use crossterm_terminal::{Clear, ClearType};
/// use crossterm_cursor::Goto;
/// use crossterm_utils::execute;
///
/// // will be executed directly
/// execute!(std::io::stdout(), Goto(5, 5));
Expand Down
4 changes: 2 additions & 2 deletions crossterm_utils/src/sys/unix.rs
Original file line number Diff line number Diff line change
@@ -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<Termios> = None;
pub static mut RAW_MODE_ENABLED: bool = false;

Expand Down
4 changes: 3 additions & 1 deletion crossterm_utils/src/sys/winapi.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down