Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.20 #567

Merged
merged 10 commits into from
Jun 10, 2021
Merged

0.20 #567

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# 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.
- `crossterm::ErrorKind` to `io::Error`.
- Added Cursor Shape Support.
- Add support for function keys F13...F20.
- Support taking any Display in `SetTitle` command.
- Remove lazy_static dependency.
- Remove extra Clone bounds in the style module.
- Add `MoveToRow` command.
- Remove writer parameter from execute_winapi

# Version 0.19
- Use single thread for async event reader.
- Patch timeout handling for event polling this was not working correctly.
Expand Down
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "crossterm"
version = "0.19.0"
version = "0.20.0"
authors = ["T. Post"]
description = "A crossplatform terminal library for manipulating terminals."
repository = "https://github.com/crossterm-rs/crossterm"
Expand Down Expand Up @@ -48,7 +48,7 @@ version = "0.3.9"
features = ["winuser"]

[target.'cfg(windows)'.dependencies]
crossterm_winapi = "0.7.0"
crossterm_winapi = "0.8"

#
# UNIX dependencies
Expand All @@ -63,10 +63,10 @@ signal-hook-mio = { version = "0.2.1", features = ["support-v0_7"] }
# Dev dependencies (examples, ...)
#
[dev-dependencies]
tokio = { version = "1.0", features = ["full"] }
tokio = { version = "1.5", features = ["full"] }
futures = "0.3"
futures-timer = "3.0"
async-std = "1.4"
async-std = "1.9"

#
# Examples
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Click to show Cargo.toml.

```toml
[dependencies]
crossterm = "0.18"
crossterm = "0.20"
```

</details>
Expand Down
2 changes: 1 addition & 1 deletion examples/interactive-demo/src/test/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use std::io::Write;

use crate::Result;
use crossterm::{cursor, execute, queue, style, style::Colorize, Command};
use crossterm::{cursor, execute, queue, style, Command, style::Stylize};
use std::thread;
use std::time::Duration;

Expand Down
14 changes: 9 additions & 5 deletions src/cursor/sys/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::convert::TryFrom;
use std::io;
use std::sync::atomic::{AtomicU64, Ordering};

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

unsafe {
if !is_true(SetConsoleCursorPosition(
if result(SetConsoleCursorPosition(
**self.screen_buffer.handle(),
position,
)) {
))
.is_err()
{
return Err(io::Error::last_os_error());
}
}
Expand All @@ -171,10 +173,12 @@ impl ScreenBufferCursor {
};

unsafe {
if !is_true(SetConsoleCursorInfo(
if result(SetConsoleCursorInfo(
**self.screen_buffer.handle(),
&cursor_info,
)) {
))
.is_err()
{
return Err(io::Error::last_os_error());
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
//! [`MoveLeft`](cursor/struct.MoveLeft.html), [`MoveRight`](cursor/struct.MoveRight.html),
//! [`MoveTo`](cursor/struct.MoveTo.html), [`MoveToColumn`](cursor/struct.MoveToColumn.html),[`MoveToRow`](cursor/struct.MoveToRow.html),
//! [`MoveToNextLine`](cursor/struct.MoveToNextLine.html), [`MoveToPreviousLine`](cursor/struct.MoveToPreviousLine.html),
//! - Shape -
//! [`SetCursorShape`](cursor/struct.SetCursorShape .html)
//! - Module [`event`](event/index.html)
//! - Mouse events - [`EnableMouseCapture`](event/struct.EnableMouseCapture.html),
//! [`DisableMouseCapture`](event/struct.DisableMouseCapture.html)
Expand Down
2 changes: 1 addition & 1 deletion src/style/styled_content.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use super::{ContentStyle, PrintStyledContent};
///
/// println!("{}", styled);
/// ```
#[derive(Copy, Clone, Debug)]
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub struct StyledContent<D: Display> {
/// The style (colors, content attributes).
style: ContentStyle,
Expand Down
2 changes: 1 addition & 1 deletion src/terminal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ impl Command for EnterAlternateScreen {

#[cfg(windows)]
fn execute_winapi(&self) -> Result<()> {
let alternate_screen = ScreenBuffer::create();
let alternate_screen = ScreenBuffer::create()?;
alternate_screen.show()?;
Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion src/terminal/sys/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ pub(crate) fn set_size(width: u16, height: u16) -> Result<()> {
screen_buffer.set_size(current_size.width - 1, current_size.height - 1)?;
}

let bounds = console.largest_window_size();
let bounds = console.largest_window_size()?;

if width > bounds.x {
return Err(ErrorKind::new(
Expand Down