diff --git a/CHANGELOG.md b/CHANGELOG.md index c5f0ed3..36a9d79 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,12 @@ -# Version 0.16.1 +# Version 0.17 +- Impl Display for MoveToColumn, MoveToNextLine, MoveToPreviousLine +- Make unix event reader always use `/dev/tty`. +- Direct write command ansi_codes into formatter instead of double allocation. +- Add NONE flag to KeyModifiers - Add support for converting chars to StylizedContent - Make terminal size function fallback to `STDOUT_FILENO` if `/dev/tty` is missing. # Version 0.16.0 -- Make terminal size function work on `/dev/tty` instead of `STDOUT_FILENO`. - Change attribute vector in `ContentStyle` to bitmask. - Add `SetAttributes` command. - Add `Attributes` type, which is a bitfield of enabled attributes. diff --git a/Cargo.toml b/Cargo.toml index f2530f5..4c86a25 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "crossterm" -version = "0.16.0" +version = "0.17.0" authors = ["T. Post"] description = "An crossplatform terminal library for manipulating terminals." repository = "https://github.com/crossterm-rs/crossterm" @@ -37,7 +37,7 @@ bitflags = "1.2" lazy_static = "1.4" parking_lot = "0.10" futures = { version = "0.3", optional = true } -serde = { version = "1.0.0", features = ["derive"], optional = true } +serde = { version = "1.0", features = ["derive"], optional = true } # # Windows dependencies @@ -54,7 +54,7 @@ crossterm_winapi = "0.6.1" # [target.'cfg(unix)'.dependencies] libc = "0.2" -mio = "0.6.21" +mio = "0.6" signal-hook = { version = "0.1.13", features = ["mio-support"] } # diff --git a/README.md b/README.md index 9cdfa64..8808fa2 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,7 @@ terminals have been tested. If you have used this library for a terminal other t issues, then feel free to add it to the above list - I really would appreciate it! ## Getting Started +_see the /examples and documentation for more advanced examples._
@@ -93,7 +94,7 @@ Click to show Cargo.toml. ```toml [dependencies] -crossterm = "0.14" +crossterm = "0.17" ```
@@ -106,6 +107,7 @@ use crossterm::{ execute, style::{Color, Print, ResetColor, SetBackgroundColor, SetForegroundColor}, ExecutableCommand, Result, + event, }; fn main() -> Result<()> { @@ -124,7 +126,7 @@ fn main() -> Result<()> { .execute(SetBackgroundColor(Color::Red))? .execute(Print("Styled text here."))? .execute(ResetColor)?; - + Ok(()) } ``` @@ -176,7 +178,7 @@ License - see the [LICENSE](https://github.com/crossterm-rs/crossterm/blob/maste [l1]: https://crates.io/crates/crossterm [s2]: https://img.shields.io/badge/license-MIT-blue.svg -[l2]: crossterm/LICENSE +[l2]: ./LICENSE [s3]: https://docs.rs/crossterm/badge.svg [l3]: https://docs.rs/crossterm/ diff --git a/src/event/sys/unix/file_descriptor.rs b/src/event/sys/unix/file_descriptor.rs index c805571..3e3e327 100644 --- a/src/event/sys/unix/file_descriptor.rs +++ b/src/event/sys/unix/file_descriptor.rs @@ -65,18 +65,14 @@ impl Drop for FileDesc { /// Creates a file descriptor pointing to the standard input or `/dev/tty`. pub fn tty_fd() -> Result { - let (fd, close_on_drop) = if unsafe { libc::isatty(libc::STDIN_FILENO) == 1 } { - (libc::STDIN_FILENO, false) - } else { - ( - fs::OpenOptions::new() - .read(true) - .write(true) - .open("/dev/tty")? - .into_raw_fd(), - true, - ) - }; + let (fd, close_on_drop) = ( + fs::OpenOptions::new() + .read(true) + .write(true) + .open("/dev/tty")? + .into_raw_fd(), + true, + ); Ok(FileDesc::new(fd, close_on_drop)) } diff --git a/src/event/sys/unix/parse.rs b/src/event/sys/unix/parse.rs index f4b2e62..1b4257a 100644 --- a/src/event/sys/unix/parse.rs +++ b/src/event/sys/unix/parse.rs @@ -88,7 +88,10 @@ pub(crate) fn parse_event(buffer: &[u8], input_available: bool) -> Result