From 75c59f32ac44b1d8c3a404c3cee938d4d5ae6a31 Mon Sep 17 00:00:00 2001 From: Timon Date: Wed, 29 Jan 2020 07:29:35 +0100 Subject: [PATCH] 0.15 (#375) --- CHANGELOG.md | 16 ++++++++-------- Cargo.toml | 2 +- src/event/source/windows.rs | 10 +++++----- src/event/sys/windows/parse.rs | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac95741..5bea968 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,11 @@ -# master -- Added a generic implementation `Command` for `&T: Command`. This allows commands to be queued by reference, as well as by value. -- Removed unnecessary trait bounds from StyledContent. -- Added `StyledContent::style_mut`. -- `execute!` and `queue!` now correctly handle errors during writing. -- Fixed minor syntax bug in `execute!` and `queue!`. -- Cleaned up implementation of `execute!` and `queue!`. -- **breaking change** Changed `ContentStyle::apply` to take self by value instead of reference, to prevent an unnecessary extra clone. +# Version 0.15.0 +- Fix CTRL + J key combination. This used to return an ENTER event. +- Add a generic implementation `Command` for `&T: Command`. This allows commands to be queued by reference, as well as by value. +- Remove unnecessary `Clone` trait bounds from `StyledContent`. +- Add `StyledContent::style_mut`. +- Handle error correctly for `execute!` and `queue!`. +- Fix minor syntax bug in `execute!` and `queue!`. +- Change `ContentStyle::apply` to take self by value instead of reference, to prevent an unnecessary extra clone. - Added basic trait implementations (`Debug`, `Clone`, `Copy`, etc) to all of the command structs - `ResetColor` uses `&'static str` instead of `String` diff --git a/Cargo.toml b/Cargo.toml index 3177d9d..c32edf5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,7 +47,7 @@ version = "0.3.8" features = ["winuser"] [target.'cfg(windows)'.dependencies] -crossterm_winapi = "0.6.0" +crossterm_winapi = "0.6.1" # # UNIX dependencies diff --git a/src/event/source/windows.rs b/src/event/source/windows.rs index 4ddec2d..daa102a 100644 --- a/src/event/source/windows.rs +++ b/src/event/source/windows.rs @@ -1,6 +1,6 @@ use std::time::Duration; -use crossterm_winapi::{Console, Handle, InputEvent, KeyEventRecord, MouseEvent}; +use crossterm_winapi::{Console, Handle, InputRecord}; use crate::event::{sys::windows::poll::WinApiPoll, Event}; @@ -36,10 +36,10 @@ impl EventSource for WindowsEventSource { if let Some(event_ready) = self.poll.poll(poll_timeout.leftover())? { if event_ready && self.console.number_of_console_input_events()? != 0 { let event = match self.console.read_single_input_event()? { - InputEvent::KeyEvent(record) => handle_key_event(record)?, - InputEvent::MouseEvent(record) => handle_mouse_event(record)?, - InputEvent::WindowBufferSizeEvent(record) => { - Some(Event::Resize(record.size.x, record.size.y)) + InputRecord::KeyEvent(record) => handle_key_event(record)?, + InputRecord::MouseEvent(record) => handle_mouse_event(record)?, + InputRecord::WindowBufferSizeEvent(record) => { + Some(Event::Resize(record.size.x as u16, record.size.y as u16)) } _ => None, }; diff --git a/src/event/sys/windows/parse.rs b/src/event/sys/windows/parse.rs index f6d906b..486cb61 100644 --- a/src/event/sys/windows/parse.rs +++ b/src/event/sys/windows/parse.rs @@ -76,7 +76,7 @@ fn parse_key_event_record(key_event: &KeyEventRecord) -> Option { VK_INSERT => Some(KeyCode::Insert), _ => { // Modifier Keys (Ctrl, Alt, Shift) Support - let character_raw = { (unsafe { *key_event.u_char.UnicodeChar() } as u16) }; + let character_raw = key_event.u_char; if character_raw < 255 { let mut character = character_raw as u8 as char;