0.17 (#403)
This commit is contained in:
parent
67a6667929
commit
9c9543d454
@ -1,9 +1,12 @@
|
|||||||
# Version 0.16.1
|
# Version 0.17
|
||||||
|
- Impl Display for MoveToColumn, MoveToNextLine, MoveToPreviousLine
|
||||||
|
- Make unix event reader always use `/dev/tty`.
|
||||||
|
- Direct write command ansi_codes into formatter instead of double allocation.
|
||||||
|
- Add NONE flag to KeyModifiers
|
||||||
- Add support for converting chars to StylizedContent
|
- Add support for converting chars to StylizedContent
|
||||||
- Make terminal size function fallback to `STDOUT_FILENO` if `/dev/tty` is missing.
|
- Make terminal size function fallback to `STDOUT_FILENO` if `/dev/tty` is missing.
|
||||||
|
|
||||||
# Version 0.16.0
|
# Version 0.16.0
|
||||||
- Make terminal size function work on `/dev/tty` instead of `STDOUT_FILENO`.
|
|
||||||
- Change attribute vector in `ContentStyle` to bitmask.
|
- Change attribute vector in `ContentStyle` to bitmask.
|
||||||
- Add `SetAttributes` command.
|
- Add `SetAttributes` command.
|
||||||
- Add `Attributes` type, which is a bitfield of enabled attributes.
|
- Add `Attributes` type, which is a bitfield of enabled attributes.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "crossterm"
|
name = "crossterm"
|
||||||
version = "0.16.0"
|
version = "0.17.0"
|
||||||
authors = ["T. Post"]
|
authors = ["T. Post"]
|
||||||
description = "An crossplatform terminal library for manipulating terminals."
|
description = "An crossplatform terminal library for manipulating terminals."
|
||||||
repository = "https://github.com/crossterm-rs/crossterm"
|
repository = "https://github.com/crossterm-rs/crossterm"
|
||||||
@ -37,7 +37,7 @@ bitflags = "1.2"
|
|||||||
lazy_static = "1.4"
|
lazy_static = "1.4"
|
||||||
parking_lot = "0.10"
|
parking_lot = "0.10"
|
||||||
futures = { version = "0.3", optional = true }
|
futures = { version = "0.3", optional = true }
|
||||||
serde = { version = "1.0.0", features = ["derive"], optional = true }
|
serde = { version = "1.0", features = ["derive"], optional = true }
|
||||||
|
|
||||||
#
|
#
|
||||||
# Windows dependencies
|
# Windows dependencies
|
||||||
@ -54,7 +54,7 @@ crossterm_winapi = "0.6.1"
|
|||||||
#
|
#
|
||||||
[target.'cfg(unix)'.dependencies]
|
[target.'cfg(unix)'.dependencies]
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
mio = "0.6.21"
|
mio = "0.6"
|
||||||
signal-hook = { version = "0.1.13", features = ["mio-support"] }
|
signal-hook = { version = "0.1.13", features = ["mio-support"] }
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -85,6 +85,7 @@ terminals have been tested. If you have used this library for a terminal other t
|
|||||||
issues, then feel free to add it to the above list - I really would appreciate it!
|
issues, then feel free to add it to the above list - I really would appreciate it!
|
||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
_see the /examples and documentation for more advanced examples._
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>
|
<summary>
|
||||||
@ -93,7 +94,7 @@ Click to show Cargo.toml.
|
|||||||
|
|
||||||
```toml
|
```toml
|
||||||
[dependencies]
|
[dependencies]
|
||||||
crossterm = "0.14"
|
crossterm = "0.17"
|
||||||
```
|
```
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
@ -106,6 +107,7 @@ use crossterm::{
|
|||||||
execute,
|
execute,
|
||||||
style::{Color, Print, ResetColor, SetBackgroundColor, SetForegroundColor},
|
style::{Color, Print, ResetColor, SetBackgroundColor, SetForegroundColor},
|
||||||
ExecutableCommand, Result,
|
ExecutableCommand, Result,
|
||||||
|
event,
|
||||||
};
|
};
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
@ -176,7 +178,7 @@ License - see the [LICENSE](https://github.com/crossterm-rs/crossterm/blob/maste
|
|||||||
[l1]: https://crates.io/crates/crossterm
|
[l1]: https://crates.io/crates/crossterm
|
||||||
|
|
||||||
[s2]: https://img.shields.io/badge/license-MIT-blue.svg
|
[s2]: https://img.shields.io/badge/license-MIT-blue.svg
|
||||||
[l2]: crossterm/LICENSE
|
[l2]: ./LICENSE
|
||||||
|
|
||||||
[s3]: https://docs.rs/crossterm/badge.svg
|
[s3]: https://docs.rs/crossterm/badge.svg
|
||||||
[l3]: https://docs.rs/crossterm/
|
[l3]: https://docs.rs/crossterm/
|
||||||
|
@ -65,18 +65,14 @@ impl Drop for FileDesc {
|
|||||||
|
|
||||||
/// Creates a file descriptor pointing to the standard input or `/dev/tty`.
|
/// Creates a file descriptor pointing to the standard input or `/dev/tty`.
|
||||||
pub fn tty_fd() -> Result<FileDesc> {
|
pub fn tty_fd() -> Result<FileDesc> {
|
||||||
let (fd, close_on_drop) = if unsafe { libc::isatty(libc::STDIN_FILENO) == 1 } {
|
let (fd, close_on_drop) = (
|
||||||
(libc::STDIN_FILENO, false)
|
|
||||||
} else {
|
|
||||||
(
|
|
||||||
fs::OpenOptions::new()
|
fs::OpenOptions::new()
|
||||||
.read(true)
|
.read(true)
|
||||||
.write(true)
|
.write(true)
|
||||||
.open("/dev/tty")?
|
.open("/dev/tty")?
|
||||||
.into_raw_fd(),
|
.into_raw_fd(),
|
||||||
true,
|
true,
|
||||||
)
|
);
|
||||||
};
|
|
||||||
|
|
||||||
Ok(FileDesc::new(fd, close_on_drop))
|
Ok(FileDesc::new(fd, close_on_drop))
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,10 @@ pub(crate) fn parse_event(buffer: &[u8], input_available: bool) -> Result<Option
|
|||||||
KeyCode::Char((c as u8 - 0x1C + b'4') as char),
|
KeyCode::Char((c as u8 - 0x1C + b'4') as char),
|
||||||
KeyModifiers::CONTROL,
|
KeyModifiers::CONTROL,
|
||||||
))))),
|
))))),
|
||||||
b'\0' => Ok(Some(InternalEvent::Event(Event::Key(KeyCode::Null.into())))),
|
b'\0' => Ok(Some(InternalEvent::Event(Event::Key(KeyEvent::new(
|
||||||
|
KeyCode::Char(' '),
|
||||||
|
KeyModifiers::CONTROL,
|
||||||
|
))))),
|
||||||
_ => parse_utf8_char(buffer).map(|maybe_char| {
|
_ => parse_utf8_char(buffer).map(|maybe_char| {
|
||||||
maybe_char
|
maybe_char
|
||||||
.map(KeyCode::Char)
|
.map(KeyCode::Char)
|
||||||
@ -193,6 +196,7 @@ pub(crate) fn parse_csi_modifier_key_code(buffer: &[u8]) -> Result<Option<Intern
|
|||||||
(53, 66) => Event::Key(KeyEvent::new(KeyCode::Down, KeyModifiers::CONTROL)),
|
(53, 66) => Event::Key(KeyEvent::new(KeyCode::Down, KeyModifiers::CONTROL)),
|
||||||
(53, 67) => Event::Key(KeyEvent::new(KeyCode::Right, KeyModifiers::CONTROL)),
|
(53, 67) => Event::Key(KeyEvent::new(KeyCode::Right, KeyModifiers::CONTROL)),
|
||||||
(53, 68) => Event::Key(KeyEvent::new(KeyCode::Left, KeyModifiers::CONTROL)),
|
(53, 68) => Event::Key(KeyEvent::new(KeyCode::Left, KeyModifiers::CONTROL)),
|
||||||
|
|
||||||
(50, 65) => Event::Key(KeyEvent::new(KeyCode::Up, KeyModifiers::SHIFT)),
|
(50, 65) => Event::Key(KeyEvent::new(KeyCode::Up, KeyModifiers::SHIFT)),
|
||||||
(50, 66) => Event::Key(KeyEvent::new(KeyCode::Down, KeyModifiers::SHIFT)),
|
(50, 66) => Event::Key(KeyEvent::new(KeyCode::Down, KeyModifiers::SHIFT)),
|
||||||
(50, 67) => Event::Key(KeyEvent::new(KeyCode::Right, KeyModifiers::SHIFT)),
|
(50, 67) => Event::Key(KeyEvent::new(KeyCode::Right, KeyModifiers::SHIFT)),
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
//! have to worry about the platform you are working with.
|
//! have to worry about the platform you are working with.
|
||||||
//!
|
//!
|
||||||
//! This crate supports all UNIX and Windows terminals down to Windows 7 (not all terminals are tested
|
//! This crate supports all UNIX and Windows terminals down to Windows 7 (not all terminals are tested
|
||||||
//! see [Tested Terminals](https://github.com/crossterm-rs/crossterm/tree/zrzka/docs-update#tested-terminals)
|
//! see [Tested Terminals](https://github.com/crossterm-rs/crossterm#tested-terminals)
|
||||||
//! for more info).
|
//! for more info).
|
||||||
//!
|
//!
|
||||||
//! ## Command API
|
//! ## Command API
|
||||||
|
Loading…
Reference in New Issue
Block a user