This commit is contained in:
Timon 2020-01-29 07:29:35 +01:00 committed by GitHub
parent f2fca91b30
commit 75c59f32ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 15 deletions

View File

@ -1,11 +1,11 @@
# master # Version 0.15.0
- Added a generic implementation `Command` for `&T: Command`. This allows commands to be queued by reference, as well as by value. - Fix CTRL + J key combination. This used to return an ENTER event.
- Removed unnecessary trait bounds from StyledContent. - Add a generic implementation `Command` for `&T: Command`. This allows commands to be queued by reference, as well as by value.
- Added `StyledContent::style_mut`. - Remove unnecessary `Clone` trait bounds from `StyledContent`.
- `execute!` and `queue!` now correctly handle errors during writing. - Add `StyledContent::style_mut`.
- Fixed minor syntax bug in `execute!` and `queue!`. - Handle error correctly for `execute!` and `queue!`.
- Cleaned up implementation of `execute!` and `queue!`. - Fix minor syntax bug in `execute!` and `queue!`.
- **breaking change** Changed `ContentStyle::apply` to take self by value instead of reference, to prevent an unnecessary extra clone. - 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 - Added basic trait implementations (`Debug`, `Clone`, `Copy`, etc) to all of the command structs
- `ResetColor` uses `&'static str` instead of `String` - `ResetColor` uses `&'static str` instead of `String`

View File

@ -47,7 +47,7 @@ version = "0.3.8"
features = ["winuser"] features = ["winuser"]
[target.'cfg(windows)'.dependencies] [target.'cfg(windows)'.dependencies]
crossterm_winapi = "0.6.0" crossterm_winapi = "0.6.1"
# #
# UNIX dependencies # UNIX dependencies

View File

@ -1,6 +1,6 @@
use std::time::Duration; 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}; 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 let Some(event_ready) = self.poll.poll(poll_timeout.leftover())? {
if event_ready && self.console.number_of_console_input_events()? != 0 { if event_ready && self.console.number_of_console_input_events()? != 0 {
let event = match self.console.read_single_input_event()? { let event = match self.console.read_single_input_event()? {
InputEvent::KeyEvent(record) => handle_key_event(record)?, InputRecord::KeyEvent(record) => handle_key_event(record)?,
InputEvent::MouseEvent(record) => handle_mouse_event(record)?, InputRecord::MouseEvent(record) => handle_mouse_event(record)?,
InputEvent::WindowBufferSizeEvent(record) => { InputRecord::WindowBufferSizeEvent(record) => {
Some(Event::Resize(record.size.x, record.size.y)) Some(Event::Resize(record.size.x as u16, record.size.y as u16))
} }
_ => None, _ => None,
}; };

View File

@ -76,7 +76,7 @@ fn parse_key_event_record(key_event: &KeyEventRecord) -> Option<KeyEvent> {
VK_INSERT => Some(KeyCode::Insert), VK_INSERT => Some(KeyCode::Insert),
_ => { _ => {
// Modifier Keys (Ctrl, Alt, Shift) Support // 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 { if character_raw < 255 {
let mut character = character_raw as u8 as char; let mut character = character_raw as u8 as char;