# Version 0.22.1
- Update yanked version crossterm-winapi and move to  crossterm-winapi 0.9.0.
- Changed panic to error when calling disable-mouse capture without setting it first.
- Update bitflags dependency.

# Version 0.22
- Fix serde Color serialisation/deserialization inconsistency.
- Update crossterm-winapi 0.8.1 to fix panic for certain mouse events
This commit is contained in:
Timon 2021-10-19 10:19:16 +02:00 committed by GitHub
parent 4e72bd1c7e
commit db956267f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 9 deletions

View File

@ -1,3 +1,12 @@
# Version 0.22.1
- Update yanked version crossterm-winapi and move to crossterm-winapi 0.9.0.
- Changed panic to error when calling disable-mouse capture without setting it first.
- Update bitflags dependency.
# Version 0.22
- Fix serde Color serialisation/deserialization inconsistency.
- Update crossterm-winapi 0.8.1 to fix panic for certain mouse events
# Version 0.21
- Expose `is_raw` function.
- Add 'purge' option on unix system, this clears the entire screen buffer.

View File

@ -1,6 +1,6 @@
[package]
name = "crossterm"
version = "0.21.0"
version = "0.22.1"
authors = ["T. Post"]
description = "A crossplatform terminal library for manipulating terminals."
repository = "https://github.com/crossterm-rs/crossterm"
@ -33,7 +33,7 @@ event-stream = ["futures-core"]
# Shared dependencies
#
[dependencies]
bitflags = "1.2"
bitflags = "1.3"
parking_lot = "0.11"
# optional deps only added when requested
@ -48,7 +48,7 @@ version = "0.3.9"
features = ["winuser"]
[target.'cfg(windows)'.dependencies]
crossterm_winapi = "0.8"
crossterm_winapi = "0.9"
#
# UNIX dependencies

View File

@ -87,7 +87,7 @@ Click to show Cargo.toml.
```toml
[dependencies]
crossterm = "0.20"
crossterm = "0.22"
```
</details>
@ -150,7 +150,7 @@ features = ["event-stream"]
| `Mio` | event readiness polling, waking up poller | UNIX only
| `signal-hook`| signalhook is used to handle terminal resize SIGNAL with Mio. | UNIX only
| `winapi`| Used for low-level windows system calls which ANSI codes can't replace| windows only
| `futures`| Can be used to for async stream of events | only with a feature flag
| `futures-core`| Can be used to for async stream of events | only with a feature flag
| `serde`| Se/dese/realizing of events | only with a feature flag

View File

@ -1,6 +1,7 @@
//! This is a WINDOWS specific implementation for input related action.
use std::convert::TryFrom;
use std::io;
use std::sync::atomic::{AtomicU64, Ordering};
use crossterm_winapi::{ConsoleMode, Handle};
@ -30,10 +31,9 @@ fn init_original_console_mode(original_mode: u32) {
}
/// Returns the original console color, make sure to call `init_console_color` before calling this function. Otherwise this function will panic.
fn original_console_mode() -> u32 {
fn original_console_mode() -> Result<u32> {
u32::try_from(ORIGINAL_CONSOLE_MODE.load(Ordering::Relaxed))
// safe unwrap, initial console color was set with `init_console_color` in `WinApiColor::new()`
.expect("Original console mode not set")
.map_err(|_| io::Error::new(io::ErrorKind::Other, "Initial console modes not set"))
}
pub(crate) fn enable_mouse_capture() -> Result<()> {
@ -46,6 +46,6 @@ pub(crate) fn enable_mouse_capture() -> Result<()> {
pub(crate) fn disable_mouse_capture() -> Result<()> {
let mode = ConsoleMode::from(Handle::current_in_handle()?);
mode.set_mode(original_console_mode())?;
mode.set_mode(original_console_mode()?)?;
Ok(())
}

View File

@ -170,6 +170,7 @@ fn parse_mouse_event_record(event: &MouseEvent) -> Result<Option<crate::event::M
}
EventFlags::DoubleClick => None, // double click not supported by unix terminals
EventFlags::MouseHwheeled => None, // horizontal scroll not supported by unix terminals
_ => None,
};
Ok(kind.map(|kind| crate::event::MouseEvent {