From f909b3db954fd47a7d1f04a55dd7f75ca058ffb5 Mon Sep 17 00:00:00 2001 From: Timon Date: Mon, 23 Aug 2021 19:07:55 +0200 Subject: [PATCH] 0.21 (#596) --- CHANGELOG.md | 5 +++++ Cargo.toml | 2 +- src/event/read.rs | 2 +- src/terminal/sys/windows.rs | 3 +++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 625b1c96b..0b6f4437b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# Version 0.21 +- Expose `is_raw` function. +- Add 'purge' option on unix system, this clears the entire screen buffer. +- Improve serialisation for color enum values. + # 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. diff --git a/Cargo.toml b/Cargo.toml index 52c8f5189..73265461f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "crossterm" -version = "0.20.0" +version = "0.21.0" authors = ["T. Post"] description = "A crossplatform terminal library for manipulating terminals." repository = "https://github.com/crossterm-rs/crossterm" diff --git a/src/event/read.rs b/src/event/read.rs index 34e8892a1..72b0830d0 100644 --- a/src/event/read.rs +++ b/src/event/read.rs @@ -43,7 +43,7 @@ impl InternalEventReader { F: Filter, { for event in &self.events { - if filter.eval(&event) { + if filter.eval(event) { return Ok(true); } } diff --git a/src/terminal/sys/windows.rs b/src/terminal/sys/windows.rs index d948b502c..0e5722774 100644 --- a/src/terminal/sys/windows.rs +++ b/src/terminal/sys/windows.rs @@ -74,6 +74,9 @@ pub(crate) fn clear(clear_type: ClearType) -> Result<()> { ClearType::FromCursorUp => clear_before_cursor(pos, buffer_size, current_attribute)?, ClearType::CurrentLine => clear_current_line(pos, buffer_size, current_attribute)?, ClearType::UntilNewLine => clear_until_line(pos, buffer_size, current_attribute)?, + _ => { + clear_entire_screen(buffer_size, current_attribute)?; + } //TODO: make purge flush the entire screen buffer not just the visible window. }; Ok(()) }