diff --git a/CHANGELOG.md b/CHANGELOG.md index a9cbb8055..625b1c96b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +# Version 0.20 +- Update from signal-hook with 'mio-feature flag' to signal-hook-mio 0.2.1. +- Manually implements Eq, PartialEq and Hash for KeyEvent improving equality checks and hash calculation. +- `crossterm::ErrorKind` to `io::Error`. +- Added Cursor Shape Support. +- Add support for function keys F13...F20. +- Support taking any Display in `SetTitle` command. +- Remove lazy_static dependency. +- Remove extra Clone bounds in the style module. + - Add `MoveToRow` command. + - Remove writer parameter from execute_winapi + # Version 0.19 - Use single thread for async event reader. - Patch timeout handling for event polling this was not working correctly. diff --git a/Cargo.toml b/Cargo.toml index 6333a5df3..fae48ff6b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "crossterm" -version = "0.19.0" +version = "0.20.0" authors = ["T. Post"] description = "A crossplatform terminal library for manipulating terminals." repository = "https://github.com/crossterm-rs/crossterm" @@ -48,7 +48,7 @@ version = "0.3.9" features = ["winuser"] [target.'cfg(windows)'.dependencies] -crossterm_winapi = "0.7.0" +crossterm_winapi = "0.8" # # UNIX dependencies @@ -63,10 +63,10 @@ signal-hook-mio = { version = "0.2.1", features = ["support-v0_7"] } # Dev dependencies (examples, ...) # [dev-dependencies] -tokio = { version = "1.0", features = ["full"] } +tokio = { version = "1.5", features = ["full"] } futures = "0.3" futures-timer = "3.0" -async-std = "1.4" +async-std = "1.9" # # Examples diff --git a/README.md b/README.md index a798f4728..374f38345 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ Click to show Cargo.toml. ```toml [dependencies] -crossterm = "0.18" +crossterm = "0.20" ``` diff --git a/examples/interactive-demo/src/test/cursor.rs b/examples/interactive-demo/src/test/cursor.rs index 028b7033d..a7c03a4da 100644 --- a/examples/interactive-demo/src/test/cursor.rs +++ b/examples/interactive-demo/src/test/cursor.rs @@ -3,7 +3,7 @@ use std::io::Write; use crate::Result; -use crossterm::{cursor, execute, queue, style, style::Colorize, Command}; +use crossterm::{cursor, execute, queue, style, Command, style::Stylize}; use std::thread; use std::time::Duration; diff --git a/src/cursor/sys/windows.rs b/src/cursor/sys/windows.rs index 1151e2224..06da423aa 100644 --- a/src/cursor/sys/windows.rs +++ b/src/cursor/sys/windows.rs @@ -4,7 +4,7 @@ use std::convert::TryFrom; use std::io; use std::sync::atomic::{AtomicU64, Ordering}; -use crossterm_winapi::{is_true, Coord, Handle, HandleType, ScreenBuffer}; +use crossterm_winapi::{result, Coord, Handle, HandleType, ScreenBuffer}; use winapi::{ shared::minwindef::{FALSE, TRUE}, um::wincon::{SetConsoleCursorInfo, SetConsoleCursorPosition, CONSOLE_CURSOR_INFO, COORD}, @@ -154,10 +154,12 @@ impl ScreenBufferCursor { let position = COORD { X: x, Y: y }; unsafe { - if !is_true(SetConsoleCursorPosition( + if result(SetConsoleCursorPosition( **self.screen_buffer.handle(), position, - )) { + )) + .is_err() + { return Err(io::Error::last_os_error()); } } @@ -171,10 +173,12 @@ impl ScreenBufferCursor { }; unsafe { - if !is_true(SetConsoleCursorInfo( + if result(SetConsoleCursorInfo( **self.screen_buffer.handle(), &cursor_info, - )) { + )) + .is_err() + { return Err(io::Error::last_os_error()); } } diff --git a/src/lib.rs b/src/lib.rs index ff3f04ed3..30c2f1e1a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -48,6 +48,8 @@ //! [`MoveLeft`](cursor/struct.MoveLeft.html), [`MoveRight`](cursor/struct.MoveRight.html), //! [`MoveTo`](cursor/struct.MoveTo.html), [`MoveToColumn`](cursor/struct.MoveToColumn.html),[`MoveToRow`](cursor/struct.MoveToRow.html), //! [`MoveToNextLine`](cursor/struct.MoveToNextLine.html), [`MoveToPreviousLine`](cursor/struct.MoveToPreviousLine.html), +//! - Shape - +//! [`SetCursorShape`](cursor/struct.SetCursorShape .html) //! - Module [`event`](event/index.html) //! - Mouse events - [`EnableMouseCapture`](event/struct.EnableMouseCapture.html), //! [`DisableMouseCapture`](event/struct.DisableMouseCapture.html) diff --git a/src/style/styled_content.rs b/src/style/styled_content.rs index a511ed28a..39ebe0dbe 100644 --- a/src/style/styled_content.rs +++ b/src/style/styled_content.rs @@ -18,7 +18,7 @@ use super::{ContentStyle, PrintStyledContent}; /// /// println!("{}", styled); /// ``` -#[derive(Copy, Clone, Debug)] +#[derive(Copy, Clone, Debug, Eq, PartialEq)] pub struct StyledContent { /// The style (colors, content attributes). style: ContentStyle, diff --git a/src/terminal.rs b/src/terminal.rs index 4782b3fb8..aa8e7f5e3 100644 --- a/src/terminal.rs +++ b/src/terminal.rs @@ -187,7 +187,7 @@ impl Command for EnterAlternateScreen { #[cfg(windows)] fn execute_winapi(&self) -> Result<()> { - let alternate_screen = ScreenBuffer::create(); + let alternate_screen = ScreenBuffer::create()?; alternate_screen.show()?; Ok(()) } diff --git a/src/terminal/sys/windows.rs b/src/terminal/sys/windows.rs index db31fcb97..33bb422c1 100644 --- a/src/terminal/sys/windows.rs +++ b/src/terminal/sys/windows.rs @@ -168,7 +168,7 @@ pub(crate) fn set_size(width: u16, height: u16) -> Result<()> { screen_buffer.set_size(current_size.width - 1, current_size.height - 1)?; } - let bounds = console.largest_window_size(); + let bounds = console.largest_window_size()?; if width > bounds.x { return Err(ErrorKind::new(