Skip to content

Commit a618a9f

Browse files
authored
0.20 (#567)
1 parent 0e8be6a commit a618a9f

File tree

9 files changed

+32
-14
lines changed

9 files changed

+32
-14
lines changed

CHANGELOG.md

+12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
# Version 0.20
2+
- Update from signal-hook with 'mio-feature flag' to signal-hook-mio 0.2.1.
3+
- Manually implements Eq, PartialEq and Hash for KeyEvent improving equality checks and hash calculation.
4+
- `crossterm::ErrorKind` to `io::Error`.
5+
- Added Cursor Shape Support.
6+
- Add support for function keys F13...F20.
7+
- Support taking any Display in `SetTitle` command.
8+
- Remove lazy_static dependency.
9+
- Remove extra Clone bounds in the style module.
10+
- Add `MoveToRow` command.
11+
- Remove writer parameter from execute_winapi
12+
113
# Version 0.19
214
- Use single thread for async event reader.
315
- Patch timeout handling for event polling this was not working correctly.

Cargo.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "crossterm"
3-
version = "0.19.0"
3+
version = "0.20.0"
44
authors = ["T. Post"]
55
description = "A crossplatform terminal library for manipulating terminals."
66
repository = "https://github.com/crossterm-rs/crossterm"
@@ -48,7 +48,7 @@ version = "0.3.9"
4848
features = ["winuser"]
4949

5050
[target.'cfg(windows)'.dependencies]
51-
crossterm_winapi = "0.7.0"
51+
crossterm_winapi = "0.8"
5252

5353
#
5454
# UNIX dependencies
@@ -63,10 +63,10 @@ signal-hook-mio = { version = "0.2.1", features = ["support-v0_7"] }
6363
# Dev dependencies (examples, ...)
6464
#
6565
[dev-dependencies]
66-
tokio = { version = "1.0", features = ["full"] }
66+
tokio = { version = "1.5", features = ["full"] }
6767
futures = "0.3"
6868
futures-timer = "3.0"
69-
async-std = "1.4"
69+
async-std = "1.9"
7070

7171
#
7272
# Examples

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Click to show Cargo.toml.
8787

8888
```toml
8989
[dependencies]
90-
crossterm = "0.18"
90+
crossterm = "0.20"
9191
```
9292

9393
</details>

examples/interactive-demo/src/test/cursor.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use std::io::Write;
44

55
use crate::Result;
6-
use crossterm::{cursor, execute, queue, style, style::Colorize, Command};
6+
use crossterm::{cursor, execute, queue, style, Command, style::Stylize};
77
use std::thread;
88
use std::time::Duration;
99

src/cursor/sys/windows.rs

+9-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::convert::TryFrom;
44
use std::io;
55
use std::sync::atomic::{AtomicU64, Ordering};
66

7-
use crossterm_winapi::{is_true, Coord, Handle, HandleType, ScreenBuffer};
7+
use crossterm_winapi::{result, Coord, Handle, HandleType, ScreenBuffer};
88
use winapi::{
99
shared::minwindef::{FALSE, TRUE},
1010
um::wincon::{SetConsoleCursorInfo, SetConsoleCursorPosition, CONSOLE_CURSOR_INFO, COORD},
@@ -154,10 +154,12 @@ impl ScreenBufferCursor {
154154
let position = COORD { X: x, Y: y };
155155

156156
unsafe {
157-
if !is_true(SetConsoleCursorPosition(
157+
if result(SetConsoleCursorPosition(
158158
**self.screen_buffer.handle(),
159159
position,
160-
)) {
160+
))
161+
.is_err()
162+
{
161163
return Err(io::Error::last_os_error());
162164
}
163165
}
@@ -171,10 +173,12 @@ impl ScreenBufferCursor {
171173
};
172174

173175
unsafe {
174-
if !is_true(SetConsoleCursorInfo(
176+
if result(SetConsoleCursorInfo(
175177
**self.screen_buffer.handle(),
176178
&cursor_info,
177-
)) {
179+
))
180+
.is_err()
181+
{
178182
return Err(io::Error::last_os_error());
179183
}
180184
}

src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
//! [`MoveLeft`](cursor/struct.MoveLeft.html), [`MoveRight`](cursor/struct.MoveRight.html),
4949
//! [`MoveTo`](cursor/struct.MoveTo.html), [`MoveToColumn`](cursor/struct.MoveToColumn.html),[`MoveToRow`](cursor/struct.MoveToRow.html),
5050
//! [`MoveToNextLine`](cursor/struct.MoveToNextLine.html), [`MoveToPreviousLine`](cursor/struct.MoveToPreviousLine.html),
51+
//! - Shape -
52+
//! [`SetCursorShape`](cursor/struct.SetCursorShape .html)
5153
//! - Module [`event`](event/index.html)
5254
//! - Mouse events - [`EnableMouseCapture`](event/struct.EnableMouseCapture.html),
5355
//! [`DisableMouseCapture`](event/struct.DisableMouseCapture.html)

src/style/styled_content.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use super::{ContentStyle, PrintStyledContent};
1818
///
1919
/// println!("{}", styled);
2020
/// ```
21-
#[derive(Copy, Clone, Debug)]
21+
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
2222
pub struct StyledContent<D: Display> {
2323
/// The style (colors, content attributes).
2424
style: ContentStyle,

src/terminal.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ impl Command for EnterAlternateScreen {
187187

188188
#[cfg(windows)]
189189
fn execute_winapi(&self) -> Result<()> {
190-
let alternate_screen = ScreenBuffer::create();
190+
let alternate_screen = ScreenBuffer::create()?;
191191
alternate_screen.show()?;
192192
Ok(())
193193
}

src/terminal/sys/windows.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ pub(crate) fn set_size(width: u16, height: u16) -> Result<()> {
168168
screen_buffer.set_size(current_size.width - 1, current_size.height - 1)?;
169169
}
170170

171-
let bounds = console.largest_window_size();
171+
let bounds = console.largest_window_size()?;
172172

173173
if width > bounds.x {
174174
return Err(ErrorKind::new(

0 commit comments

Comments
 (0)