This commit is contained in:
Timon 2019-09-24 19:45:59 +02:00 committed by GitHub
parent 4e1fe5a625
commit e600eabaed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 392 additions and 170 deletions

View File

@ -1,9 +1,9 @@
[package] [package]
name = "crossterm" name = "crossterm"
version = "0.10.1" version = "0.11.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/TimonPost/crossterm" repository = "https://github.com/crossterm-rs/crossterm"
documentation = "https://docs.rs/crossterm/" documentation = "https://docs.rs/crossterm/"
license = "MIT" license = "MIT"
keywords = ["console", "color", "cursor", "input", "terminal"] keywords = ["console", "color", "cursor", "input", "terminal"]
@ -37,12 +37,12 @@ exclude = [
] ]
[dependencies] [dependencies]
crossterm_screen = { optional = true, path = "./crossterm_screen", version = "0.2.4" } crossterm_screen = { path = "./crossterm_screen", version = "0.3.0" , optional = true }
crossterm_cursor = { optional = true, path = "./crossterm_cursor", version = "0.2.5" } crossterm_cursor = { path = "./crossterm_cursor", version = "0.3.0" , optional = true }
crossterm_terminal = { optional = true, path = "./crossterm_terminal", version = "0.2.5" } crossterm_terminal = { path = "./crossterm_terminal", version = "0.3.0", optional = true }
crossterm_style = { optional = true, path = "./crossterm_style", version = "0.4.0" } crossterm_style = { path = "./crossterm_style", version = "0.5.0" , optional = true }
crossterm_input = { optional = true, path = "./crossterm_input", version = "0.3.8" } crossterm_input = { path = "./crossterm_input", version = "0.4.0" , optional = true }
crossterm_utils = { optional = false, path = "./crossterm_utils", version = "0.2.4"} crossterm_utils = { path = "./crossterm_utils", version = "0.3.0" , optional = false }
[lib] [lib]
name = "crossterm" name = "crossterm"

View File

@ -1,5 +1,7 @@
# Crossterm | cross-platform terminal manipulating library. <h1 align="center"><img width="440" src="docs/crossterm_full.png" /></h1>
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Z8QK6XU749JB2) ![Travis][s7] ![Workflow][s8] [![Latest Version][s1]][l1] [![MIT][s2]][l2] [![docs][s3]][l3] ![Lines of Code][s6] [![Join us on Discord][s5]][l5]
# cross-platform terminal manipulating library.
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Z8QK6XU749JB2) ![Travis][s7] [![Latest Version][s1]][l1] [![MIT][s2]][l2] [![docs][s3]][l3] ![Lines of Code][s6] [![Join us on Discord][s5]][l5]
[s1]: https://img.shields.io/crates/v/crossterm.svg [s1]: https://img.shields.io/crates/v/crossterm.svg
[l1]: https://crates.io/crates/crossterm [l1]: https://crates.io/crates/crossterm
@ -16,10 +18,8 @@
[s5]: https://img.shields.io/discord/560857607196377088.svg?logo=discord [s5]: https://img.shields.io/discord/560857607196377088.svg?logo=discord
[l5]: https://discord.gg/K4nyTDB [l5]: https://discord.gg/K4nyTDB
[s6]: https://tokei.rs/b1/github/TimonPost/crossterm?category=code [s6]: https://tokei.rs/b1/github/crossterm-rs/crossterm?category=code
[s7]: https://travis-ci.org/TimonPost/crossterm.svg?branch=master [s7]: https://travis-ci.org/crossterm-rs/crossterm.svg?branch=master
[s8]: https://github.com/TimonPost/crossterm/workflows/Crossterm%20Test/badge.svg
Have you ever been disappointed when a terminal library for rust was only written for UNIX systems? Have you ever been disappointed when a terminal library for rust was only written for UNIX systems?
Crossterm provides clearing, input handling, styling, cursor movement, and terminal actions for both Windows and UNIX systems. Crossterm provides clearing, input handling, styling, cursor movement, and terminal actions for both Windows and UNIX systems.
@ -29,7 +29,7 @@ Through the simplicity of Crossterm, you do not have to worry about the platform
This crate supports all UNIX and Windows terminals down to Windows 7 (not all terminals are tested see [Tested Terminals](#tested-terminals) for more info). This crate supports all UNIX and Windows terminals down to Windows 7 (not all terminals are tested see [Tested Terminals](#tested-terminals) for more info).
This crate consists of five modules that are provided behind [feature flags](https://timonpost.github.io/crossterm/docs/feature_flags.html) so that you can define which features you'd like to have; by default, all features are enabled. This crate consists of five modules that are provided behind [feature flags](https://crossterm-rs.github.io/crossterm/docs/feature_flags.html) so that you can define which features you'd like to have; by default, all features are enabled.
- [Crossterm Style](https://crates.io/crates/crossterm_style) - [Crossterm Style](https://crates.io/crates/crossterm_style)
- [Crossterm Input](https://crates.io/crates/crossterm_input) - [Crossterm Input](https://crates.io/crates/crossterm_input)
- [Crossterm Screen](https://crates.io/crates/crossterm_screen) - [Crossterm Screen](https://crates.io/crates/crossterm_screen)
@ -55,22 +55,22 @@ This crate consists of five modules that are provided behind [feature flags](htt
## Getting Started ## Getting Started
This documentation is only for Crossterm version `^0.10`. If you have an older version of Crossterm, then I suggest you check the [Upgrade Manual](https://github.com/TimonPost/crossterm/blob/master/docs/UPGRADE.md). Also, check out the [examples](https://github.com/TimonPost/crossterm/tree/master/examples) folders with detailed examples for all functionality of this crate. All [examples](https://github.com/crossterm-rs/crossterm/tree/master/examples) of how crossterm works can be found in the example directory.
Add the Crossterm package to your `Cargo.toml` file. Add the Crossterm package to your `Cargo.toml` file.
``` ```
[dependencies] [dependencies]
crossterm = "^0.10" crossterm = "^0.11"
``` ```
### Useful Links ### Useful Links
- [Book](https://timonpost.github.io/crossterm/docs//) - [Book](https://crossterm-rs.github.io/crossterm/docs//)
- [Documentation](https://docs.rs/crossterm/) - [Documentation](https://docs.rs/crossterm/)
- [Crates.io](https://crates.io/crates/crossterm) - [Crates.io](https://crates.io/crates/crossterm)
- [Program Examples](https://github.com/TimonPost/crossterm/tree/master/examples/program_examples) - [Program Examples](https://github.com/crossterm-rs/crossterm/tree/master/examples/program_examples)
- [Examples](https://github.com/TimonPost/crossterm/tree/master/examples) - [Examples](https://github.com/crossterm-rs/crossterm/tree/master/examples)
## Features ## Features
@ -89,7 +89,7 @@ crossterm = "^0.10"
- Background Color (16 base colors) - Background Color (16 base colors)
- 256 (ANSI) Color Support (Windows 10 and UNIX Only) - 256 (ANSI) Color Support (Windows 10 and UNIX Only)
- RGB Color Support (Windows 10 and UNIX only) - RGB Color Support (Windows 10 and UNIX only)
- Text Attributes: bold, italic, underscore and crossed word and [more](https://timonpost.github.io/crossterm/docs//styling.html#attributes) (Windows 10 and UNIX only) - Text Attributes: bold, italic, underscore and crossed word and [more](https://crossterm-rs.github.io/crossterm/docs//styling.html#attributes) (Windows 10 and UNIX only)
- Terminal - Terminal
- Clearing (all lines, current line, from cursor down and up, until new line) - Clearing (all lines, current line, from cursor down and up, until new line)
- Scrolling (up, down) - Scrolling (up, down)
@ -104,24 +104,22 @@ crossterm = "^0.10"
- Read mouse input events (press, release, position, button) - Read mouse input events (press, release, position, button)
## Examples ## Examples
These are some basic examples demonstrating how to use this crate. See [examples](https://github.com/TimonPost/crossterm/blob/master/examples/) for more. These are some basic examples demonstrating how to use this crate. See [examples](https://github.com/crossterm-rs/crossterm/blob/master/examples/) for more.
### Command API ### Command API
My first recommendation is to use the [command API](https://timonpost.github.io/crossterm/docs/command.html) because this might replace some of the existing API in the future. My first recommendation is to use the [command API](https://crossterm-rs.github.io/crossterm/docs/command.html) because this might replace some of the existing API in the future.
Because it is more convenient, faster, and easier to use. Because it is more convenient, faster, and easier to use.
### Styled Text ### Styled Text
This module enables you to style the terminal text. This module enables you to style the terminal text.
Good documentation can be found at the following places: [docs](https://docs.rs/crossterm_style/), [book](https://timonpost.github.io/crossterm/docs/styling.html), [examples](https://github.com/TimonPost/crossterm/tree/master/examples/key_events.rs) Good documentation can be found at the following places: [docs](https://docs.rs/crossterm_style/), [book](https://crossterm-rs.github.io/crossterm/docs/styling.html), [examples](https://github.com/crossterm-rs/crossterm/tree/master/examples/key_events.rs)
_imports_
```rust
use crossterm::{Colored, Color, Colorize, Styler, Attribute};
```
_style text with attributes_ _style text with attributes_
```rust ```rust
use crossterm::{Colored, Color, Colorize, Styler, Attribute};
// pass any `Attribute` value to the formatting braces. // pass any `Attribute` value to the formatting braces.
println!("{} Underlined {} No Underline", Attribute::Underlined, Attribute::NoUnderline); println!("{} Underlined {} No Underline", Attribute::Underlined, Attribute::NoUnderline);
@ -156,7 +154,7 @@ println!("{} some colored text", Colored::Fg(Color::AnsiValue(10)));
### Cursor ### Cursor
This module enables you to work with the terminal cursor. This module enables you to work with the terminal cursor.
Good documentation could be found on the following places: [docs](https://docs.rs/crossterm_cursor/), [examples](https://github.com/TimonPost/crossterm/tree/master/examples/cursor.rs) Good documentation could be found on the following places: [docs](https://docs.rs/crossterm_cursor/), [examples](https://github.com/crossterm-rs/crossterm/tree/master/examples/cursor.rs)
```rust ```rust
use crossterm::cursor; use crossterm::cursor;
@ -198,7 +196,7 @@ cursor.blink(true)
### Terminal ### Terminal
This module enables you to work with the terminal in general. This module enables you to work with the terminal in general.
Good documentation could be found on the following places: [docs](https://docs.rs/crossterm_terminal/), [examples](https://github.com/TimonPost/crossterm/tree/master/examples/terminal.rs). Good documentation could be found on the following places: [docs](https://docs.rs/crossterm_terminal/), [examples](https://github.com/crossterm-rs/crossterm/tree/master/examples/terminal.rs).
```rust ```rust
use crossterm::{terminal,ClearType}; use crossterm::{terminal,ClearType};
@ -237,7 +235,7 @@ terminal.write("Some text\n Some text on new line");
### Input Reading ### Input Reading
This module enables you to read user input events. This module enables you to read user input events.
Good documentation could be found on the following places: [docs](https://docs.rs/crossterm_input/), [book](https://timonpost.github.io/crossterm/docs/input.html), [examples](https://github.com/TimonPost/crossterm/tree/master/examples/key_events.rs) Good documentation could be found on the following places: [docs](https://docs.rs/crossterm_input/), [book](https://crossterm-rs.github.io/crossterm/docs/input.html), [examples](https://github.com/crossterm-rs/crossterm/tree/master/examples/key_events.rs)
_available imports_ _available imports_
```rust ```rust
@ -294,7 +292,7 @@ input.disable_mouse_mode().unwrap();
``` ```
### Alternate and Raw Screen ### Alternate and Raw Screen
These concepts are a little more complex and would take over the README, please check out the [docs](https://docs.rs/crossterm_screen/), [book](https://timonpost.github.io/crossterm/docs/screen.html), and [examples](https://github.com/TimonPost/crossterm/tree/master/examples). These concepts are a little more complex and would take over the README, please check out the [docs](https://docs.rs/crossterm_screen/), [book](https://crossterm-rs.github.io/crossterm/docs/screen.html), and [examples](https://github.com/crossterm-rs/crossterm/tree/master/examples).
## Used By ## Used By
- [Broot](https://dystroy.org/broot/) - [Broot](https://dystroy.org/broot/)
@ -328,10 +326,10 @@ Please visit the discord or issue list for more information
## Support ## Support
Crossterm took a lot of time to develop, I appreciate any donation given to support the development of crossterm. Would you like crossterm to be even more gorgeous and beautiful? You can help with this by donating.
[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Z8QK6XU749JB2) [![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Z8QK6XU749JB2)
## License ## License
This project, crossterm and all it's sub-modules: crossterm_screen, crossterm_cursor, crossterm_style, crossterm_input, crossterm_terminal, crossterm_winapi, crossterm_utils are licensed under the MIT License - see the [LICENSE.md](https://github.com/TimonPost/crossterm/blob/master/LICENSE) file for details This project, crossterm and all it's sub-modules: crossterm_screen, crossterm_cursor, crossterm_style, crossterm_input, crossterm_terminal, crossterm_winapi, crossterm_utils are licensed under the MIT License - see the [LICENSE.md](https://github.com/crossterm-rs/crossterm/blob/master/LICENSE) file for details

View File

@ -1,3 +1,13 @@
# Changes crossterm_cursor 0.3
- `TerminalCursor::pos()` returns `crossterm::Result<(u16, u16)>`
- `TerminalCursor::move_*` returns `crossterm::Result`
- `TerminalCursor::reset_position()` to `restore_position()`
- All `i16` values for indexing: set/get cursor pos synced to `u16` values
- `Command::get_anis_code()` to `ansi_code()`
- `ExecutableCommand::queue` returns `crossterm::Result`
- `QueueableCommand::queue` returns `crossterm::Result`
- Command API takes mutable self instead of self
# Changes crossterm_cursor 0.2 # Changes crossterm_cursor 0.2
- Removed `TerminalCursor::from_output()` - Removed `TerminalCursor::from_output()`

View File

@ -1,9 +1,9 @@
[package] [package]
name = "crossterm_cursor" name = "crossterm_cursor"
version = "0.2.5" version = "0.3.0"
authors = ["T. Post"] authors = ["T. Post"]
description = "A cross-platform library for moving the terminal cursor." description = "A cross-platform library for moving the terminal cursor."
repository = "https://github.com/TimonPost/crossterm" repository = "https://github.com/crossterm-rs/crossterm"
documentation = "https://docs.rs/crossterm_cursor/" documentation = "https://docs.rs/crossterm_cursor/"
license = "MIT" license = "MIT"
keywords = ["cursor", "cli", "crossterm", "crossplatform", "terminal"] keywords = ["cursor", "cli", "crossterm", "crossplatform", "terminal"]
@ -12,8 +12,8 @@ readme = "README.md"
edition = "2018" edition = "2018"
[target.'cfg(windows)'.dependencies] [target.'cfg(windows)'.dependencies]
winapi = { version = "0.3.7", features = ["wincon","winnt","minwindef"] } winapi = { version = "0.3.8", features = ["wincon","winnt","minwindef"] }
crossterm_winapi = { path="../crossterm_winapi", version = "0.1.5"} crossterm_winapi = { path="../crossterm_winapi", version = "0.2.0"}
[dependencies] [dependencies]
crossterm_utils = { path="../crossterm_utils", version = "0.2.4"} crossterm_utils = { path="../crossterm_utils", version = "0.3.0"}

View File

@ -13,7 +13,7 @@
[s5]: https://img.shields.io/discord/560857607196377088.svg?logo=discord [s5]: https://img.shields.io/discord/560857607196377088.svg?logo=discord
[l5]: https://discord.gg/K4nyTDB [l5]: https://discord.gg/K4nyTDB
[s7]: https://travis-ci.org/TimonPost/crossterm.svg?branch=master [s7]: https://travis-ci.org/crossterm-rs/crossterm.svg?branch=master
This crate allows you to move the terminal cursor cross-platform. This crate allows you to move the terminal cursor cross-platform.
It supports all UNIX and windows terminals down to windows 7 (not all terminals are tested see [Tested Terminals](#tested-terminals) for more info) It supports all UNIX and windows terminals down to windows 7 (not all terminals are tested see [Tested Terminals](#tested-terminals) for more info)
@ -26,7 +26,7 @@ Other sub-crates are:
- [Crossterm Screen](https://crates.io/crates/crossterm_screen) - [Crossterm Screen](https://crates.io/crates/crossterm_screen)
- [Crossterm Input](https://crates.io/crates/crossterm_input) - [Crossterm Input](https://crates.io/crates/crossterm_input)
When you want to use other modules as well you might want to use crossterm with [feature flags](https://timonpost.github.io/crossterm/docs/feature_flags.html). When you want to use other modules as well you might want to use crossterm with [feature flags](https://crossterm-rs.github.io/crossterm/docs/feature_flags.html).
## Table of contents: ## Table of contents:
- [Getting started](#getting-started) - [Getting started](#getting-started)
@ -39,7 +39,7 @@ When you want to use other modules as well you might want to use crossterm with
## Getting Started ## Getting Started
This documentation is only for `crossterm_cursor` version `0.2`. Also, check out the [examples](examples/cursor.rs) folders with detailed examples for all functionality of this crate. All examples of how `crossterm_cursor` works can be found in the [examples](https://github.com/crossterm-rs/crossterm/tree/master/examples) directory.
Add the `crossterm_cursor` package to your `Cargo.toml` file. Add the `crossterm_cursor` package to your `Cargo.toml` file.
@ -75,11 +75,11 @@ These are the features of this crate:
## Command API ## Command API
My first recommendation is to use the [command API](https://timonpost.github.io/crossterm/docs/command.html) because this might replace some of the existing API in the future. My first recommendation is to use the [command API](https://crossterm-rs.github.io/crossterm/docs/command.html) because this might replace some of the existing API in the future.
Because it is more convenient, faster, and easier to use. Because it is more convenient, faster, and easier to use.
## Examples ## Examples
The [examples](https://github.com/TimonPost/crossterm/tree/master/examples) folder has more complete and verbose examples. The [examples](https://github.com/crossterm-rs/crossterm/tree/master/examples) folder has more complete and verbose examples.
```rust ```rust
use crossterm_cursor::cursor; use crossterm_cursor::cursor;

View File

@ -1,3 +1,17 @@
# Changes crossterm_input 0.4.0
- `TerminalInput::read_line` returns `crossterm::Result` instead of `io::Result`
- `TerminalInput::read_char` returns `crossterm::Result` instead of `io::Result`
- `Command::get_anis_code()` to `ansi_code()`
- Added KeyEvent::Enter and KeyEvent::Tab: [added-key-event-enter], [added-key-event-tab]
- `ExecutableCommand::queue` returns `crossterm::Result`
- `QueueableCommand::queue` returns `crossterm::Result`
- Added derives: Serialize/Deserialize for key events [serde]
- Command API takes mutable self instead of self
[added-key-event-tab]: https://github.com/crossterm-rs/crossterm/pull/239
[added-key-event-enter]: https://github.com/crossterm-rs/crossterm/pull/236
[serde]: https://github.com/crossterm-rs/crossterm/pull/190
# Changes crossterm_input 0.3.3 # Changes crossterm_input 0.3.3
- Removed println from `SyncReader` - Removed println from `SyncReader`

View File

@ -1,9 +1,9 @@
[package] [package]
name = "crossterm_input" name = "crossterm_input"
version = "0.3.8" version = "0.4.0"
authors = ["T. Post"] authors = ["T. Post"]
description = "A cross-platform library for reading userinput." description = "A cross-platform library for reading userinput."
repository = "https://github.com/TimonPost/crossterm" repository = "https://github.com/crossterm-rs/crossterm"
documentation = "https://docs.rs/crossterm_input/" documentation = "https://docs.rs/crossterm_input/"
license = "MIT" license = "MIT"
keywords = ["input", "keys", "crossterm", "events", "terminal"] keywords = ["input", "keys", "crossterm", "events", "terminal"]
@ -12,13 +12,13 @@ readme = "README.md"
edition = "2018" edition = "2018"
[target.'cfg(windows)'.dependencies] [target.'cfg(windows)'.dependencies]
winapi = { version = "0.3.7", features = ["winnt", "winuser"] } winapi = { version = "0.3.8", features = ["winnt", "winuser"] }
crossterm_winapi = { path="../crossterm_winapi", version = "0.1.5"} crossterm_winapi = { path="../crossterm_winapi", version = "0.2.0"}
[target.'cfg(unix)'.dependencies] [target.'cfg(unix)'.dependencies]
libc = "0.2.51" libc = "0.2.51"
[dependencies] [dependencies]
crossterm_utils = { path="../crossterm_utils", version = "0.2.4"} crossterm_utils = { path="../crossterm_utils", version = "0.3.0"}
crossterm_screen = {path="../crossterm_screen", version = "0.2.4"} crossterm_screen = {path="../crossterm_screen", version = "0.3.0"}
serde = { version = "1.0", features = ["derive"], optional = true } serde = { version = "1.0", features = ["derive"], optional = true }

View File

@ -13,7 +13,7 @@
[s5]: https://img.shields.io/discord/560857607196377088.svg?logo=discord [s5]: https://img.shields.io/discord/560857607196377088.svg?logo=discord
[l5]: https://discord.gg/K4nyTDB [l5]: https://discord.gg/K4nyTDB
[s7]: https://travis-ci.org/TimonPost/crossterm.svg?branch=master [s7]: https://travis-ci.org/crossterm-rs/crossterm.svg?branch=master
This crate allows you to read the user input cross-platform. This crate allows you to read the user input cross-platform.
It supports all UNIX and windows terminals down to windows 7 (not all terminals are tested see [Tested Terminals](#tested-terminals) for more info) It supports all UNIX and windows terminals down to windows 7 (not all terminals are tested see [Tested Terminals](#tested-terminals) for more info)
@ -26,7 +26,7 @@ Other sub-crates are:
- [Crossterm Screen](https://crates.io/crates/crossterm_screen) - [Crossterm Screen](https://crates.io/crates/crossterm_screen)
- [Crossterm Cursor](https://crates.io/crates/crossterm_cursor) - [Crossterm Cursor](https://crates.io/crates/crossterm_cursor)
When you want to use other modules as well you might want to use crossterm with [feature flags](https://timonpost.github.io/crossterm/docs/feature_flags.html). When you want to use other modules as well you might want to use crossterm with [feature flags](https://crossterm-rs.github.io/crossterm/docs/feature_flags.html).
## Table of contents: ## Table of contents:
- [Getting started](#getting-started) - [Getting started](#getting-started)
@ -41,7 +41,7 @@ When you want to use other modules as well you might want to use crossterm with
## Getting Started ## Getting Started
This documentation is only for `crossterm_input` version `0.3` if you have an older version I suggest you check the [Upgrade Manual](https://github.com/TimonPost/crossterm/blob/master/docs/UPGRADE.md). Also, check out the [examples](https://github.com/TimonPost/crossterm/tree/master/crossterm_input/examples) folders with detailed examples for all functionalities of this crate. All examples of how `crossterm_input` works can be found in the [examples](https://github.com/crossterm-rs/crossterm/tree/master/examples) directory.
Add the `crossterm_input` package to your `Cargo.toml` file. Add the `crossterm_input` package to your `Cargo.toml` file.
@ -59,7 +59,7 @@ pub use crossterm_input::{input, AsyncReader, InputEvent, KeyEvent, MouseButton,
- [Documentation](https://docs.rs/crossterm_input/) - [Documentation](https://docs.rs/crossterm_input/)
- [Crates.io](https://crates.io/crates/crossterm_input) - [Crates.io](https://crates.io/crates/crossterm_input)
- [Book](https://timonpost.github.io/crossterm/docs/input.html) - [Book](https://crossterm-rs.github.io/crossterm/docs/input.html)
- [Examples](./examples) - [Examples](./examples)
## Features ## Features
@ -77,7 +77,7 @@ These are the features of this crate:
- RawScreen (from `crossterm_screen`) - RawScreen (from `crossterm_screen`)
## Examples ## Examples
The [examples](https://github.com/TimonPost/crossterm/tree/master/examples) folder has more complete and verbose examples. The [examples](https://github.com/crossterm-rs/crossterm/tree/master/examples) folder has more complete and verbose examples.
_Simple Readings_ _Simple Readings_
```rust ```rust

View File

@ -0,0 +1,7 @@
# Changes crossterm_screen 0.3.0
- `RawScreen::into_raw_mode` returns `crossterm::Result` instead of `io::Result`
- `RawScreen::disable_raw_mode` returns `crossterm::Result` instead of `io::Result`
- `AlternateScreen::to_alternate` returns `crossterm::Result` instead of `io::Result`
- `AsyncReader::stop_reading()` to `stop()`
- `RawScreen::disable_raw_mode_on_drop` to `keep_raw_mode_on_drop`

View File

@ -1,9 +1,9 @@
[package] [package]
name = "crossterm_screen" name = "crossterm_screen"
version = "0.2.4" version = "0.3.0"
authors = ["T. Post"] authors = ["T. Post"]
description = "A cross-platform library for raw and alternate screen." description = "A cross-platform library for raw and alternate screen."
repository = "https://github.com/TimonPost/crossterm" repository = "https://github.com/crossterm-rs/crossterm"
documentation = "https://docs.rs/crossterm_screen/" documentation = "https://docs.rs/crossterm_screen/"
license = "MIT" license = "MIT"
keywords = ["screen", "alternate", "raw", "crossterm", "terminal"] keywords = ["screen", "alternate", "raw", "crossterm", "terminal"]
@ -12,8 +12,8 @@ readme = "README.md"
edition = "2018" edition = "2018"
[dependencies] [dependencies]
crossterm_utils = { path="../crossterm_utils", version = "0.2.4"} crossterm_utils = { path="../crossterm_utils", version = "0.3.0"}
[target.'cfg(windows)'.dependencies] [target.'cfg(windows)'.dependencies]
winapi = { version = "0.3.7", features = ["minwindef", "wincon"] } winapi = { version = "0.3.8", features = ["minwindef", "wincon"] }
crossterm_winapi = { path="../crossterm_winapi", version = "0.1.5"} crossterm_winapi = { path="../crossterm_winapi", version = "0.2.0" }

View File

@ -13,7 +13,7 @@
[s5]: https://img.shields.io/discord/560857607196377088.svg?logo=discord [s5]: https://img.shields.io/discord/560857607196377088.svg?logo=discord
[l5]: https://discord.gg/K4nyTDB [l5]: https://discord.gg/K4nyTDB
[s7]: https://travis-ci.org/TimonPost/crossterm.svg?branch=master [s7]: https://travis-ci.org/crossterm-rs/crossterm.svg?branch=master
This crate allows you to work with alternate and raw screen cross-platform. This crate allows you to work with alternate and raw screen cross-platform.
It supports all UNIX and windows terminals down to windows 7 (not all terminals are tested see [Tested Terminals](#tested-terminals) for more info) It supports all UNIX and windows terminals down to windows 7 (not all terminals are tested see [Tested Terminals](#tested-terminals) for more info)
@ -26,9 +26,9 @@ Other sub-crates are:
- [Crossterm Input](https://crates.io/crates/crossterm_input) - [Crossterm Input](https://crates.io/crates/crossterm_input)
- [Crossterm Cursor](https://crates.io/crates/crossterm_cursor) - [Crossterm Cursor](https://crates.io/crates/crossterm_cursor)
When you want to use other modules as well you might want to use crossterm with [feature flags](https://timonpost.github.io/crossterm/docs/feature_flags.html). When you want to use other modules as well you might want to use crossterm with [feature flags](https://crossterm-rs.github.io/crossterm/docs/feature_flags.html).
In case you are wondering what 'alternate' or 'raw' screen is, you could checkout the [book](https://timonpost.github.io/crossterm/docs/screen.html) describing this in more detail. In case you are wondering what 'alternate' or 'raw' screen is, you could checkout the [book](https://crossterm-rs.github.io/crossterm/docs/screen.html) describing this in more detail.
## Table of contents: ## Table of contents:
- [Getting started](#getting-started) - [Getting started](#getting-started)
@ -43,9 +43,8 @@ In case you are wondering what 'alternate' or 'raw' screen is, you could checkou
## Getting Started ## Getting Started
This documentation is only for `crossterm_screen` version `0.2`. All examples of how `crossterm_input` works can be found in the [examples](https://github.com/crossterm-rs/crossterm/tree/master/examples) directory.
Also, check out the [examples](https://github.com/TimonPost/crossterm/tree/master/examples) folders with detailed examples for all functionality of this crate And you might consider reading the [book](https://crossterm-rs.github.io/crossterm/docs/screen.html) which has a dedicated section on alternate and raw modes.
and the [book](https://timonpost.github.io/crossterm/docs/screen.html) for more information about how to use the alternate or raw screen options.
Add the `crossterm_screen` package to your `Cargo.toml` file. Add the `crossterm_screen` package to your `Cargo.toml` file.
@ -64,7 +63,7 @@ pub use crossterm_screen::{AlternateScreen, RawScreen};
- [Documentation](https://docs.rs/crossterm_screen/) - [Documentation](https://docs.rs/crossterm_screen/)
- [Crates.io](https://crates.io/crates/crossterm_screen) - [Crates.io](https://crates.io/crates/crossterm_screen)
- [Book](https://timonpost.github.io/crossterm/docs/screen.html) - [Book](https://crossterm-rs.github.io/crossterm/docs/screen.html)
- [Examples](./examples) - [Examples](./examples)
## Features ## Features
@ -81,7 +80,7 @@ Planned features:
- make is possible to switch between multiple buffers. - make is possible to switch between multiple buffers.
## Examples ## Examples
The [examples](https://github.com/TimonPost/crossterm/tree/master/examples) folder has more complete and verbose examples. The [examples](https://github.com/crossterm-rs/crossterm/tree/master/examples) folder has more complete and verbose examples.
## Tested terminals ## Tested terminals
- Windows Powershell - Windows Powershell

View File

@ -1,10 +1,18 @@
# Changes crossterm_style 0.4
- `get_available_color_count` returns no result
- `ExecutableCommand::queue` returns `crossterm::Result`
- `QueueableCommand::queue` returns `crossterm::Result`
- `available_color_count` to `available_color_count()`
- Added derives: `Debug` for `ObjectStyle` [debug-derive]
- Command API takes mutable self instead of self
# Changes crossterm_style 0.3 # Changes crossterm_style 0.3
- Removed `TerminalColor::from_output()` - Removed `TerminalColor::from_output()`
- Added `NoItalic` attribute - Added `NoItalic` attribute
# Changes crossterm_style 0.2 # Changes crossterm_style 0.2
- Introduced more `Attributes` - Introduced more `Attributes`
- Introduced easier ways to style text [issue 87](https://github.com/TimonPost/crossterm/issues/87). - Introduced easier ways to style text [issue 87](https://github.com/crossterm-rs/crossterm/issues/87).
- Removed `ColorType` since it was unnecessary. - Removed `ColorType` since it was unnecessary.
# Changes crossterm_style 0.1 # Changes crossterm_style 0.1

View File

@ -1,9 +1,9 @@
[package] [package]
name = "crossterm_style" name = "crossterm_style"
version = "0.4.0" version = "0.5.0"
authors = ["T. Post"] authors = ["T. Post"]
description = "A cross-platform library styling the terminal output." description = "A cross-platform library styling the terminal output."
repository = "https://github.com/TimonPost/crossterm" repository = "https://github.com/crossterm-rs/crossterm"
documentation = "https://docs.rs/crossterm_style/" documentation = "https://docs.rs/crossterm_style/"
license = "MIT" license = "MIT"
keywords = ["style", "color", "attributes", "crossterm", "terminal"] keywords = ["style", "color", "attributes", "crossterm", "terminal"]
@ -12,9 +12,9 @@ readme = "README.md"
edition = "2018" edition = "2018"
[target.'cfg(windows)'.dependencies] [target.'cfg(windows)'.dependencies]
winapi = { version = "0.3.7", features = ["wincon"] } winapi = { version = "0.3.8", features = ["wincon"] }
crossterm_winapi = { path="../crossterm_winapi", version = "0.1.5"} crossterm_winapi = { path="../crossterm_winapi", version = "0.2.0"}
[dependencies] [dependencies]
crossterm_utils = { path="../crossterm_utils", version = "0.2.4"} crossterm_utils = { path="../crossterm_utils", version = "0.3.0"}
serde = { version = "1.0.0", features = ["derive"], optional = true } serde = { version = "1.0.0", features = ["derive"], optional = true }

View File

@ -13,7 +13,7 @@
[s5]: https://img.shields.io/discord/560857607196377088.svg?logo=discord [s5]: https://img.shields.io/discord/560857607196377088.svg?logo=discord
[l5]: https://discord.gg/K4nyTDB [l5]: https://discord.gg/K4nyTDB
[s7]: https://travis-ci.org/TimonPost/crossterm.svg?branch=master [s7]: https://travis-ci.org/crossterm-rs/crossterm.svg?branch=master
This crate allows you to style the terminal cross-platform. This crate allows you to style the terminal cross-platform.
It supports all UNIX and windows terminals down to windows 7 (not all terminals are tested see [Tested Terminals](#tested-terminals) for more info) It supports all UNIX and windows terminals down to windows 7 (not all terminals are tested see [Tested Terminals](#tested-terminals) for more info)
@ -26,7 +26,7 @@ Other sub-crates are:
- [Crossterm Screen](https://crates.io/crates/crossterm_screen) - [Crossterm Screen](https://crates.io/crates/crossterm_screen)
- [Crossterm Cursor](https://crates.io/crates/crossterm_cursor) - [Crossterm Cursor](https://crates.io/crates/crossterm_cursor)
When you want to use other modules as well you might want to use crossterm with [feature flags](https://timonpost.github.io/crossterm/docs/feature_flags.html). When you want to use other modules as well you might want to use crossterm with [feature flags](https://crossterm-rs.github.io/crossterm/docs/feature_flags.html).
## Table of contents: ## Table of contents:
- [Getting started](#getting-started) - [Getting started](#getting-started)
@ -41,7 +41,7 @@ When you want to use other modules as well you might want to use crossterm with
## Getting Started ## Getting Started
This documentation is only for `crossterm_style` version `0.3` if you have an older version I suggest you check the [Upgrade Manual](https://github.com/TimonPost/crossterm/blob/master/docs/UPGRADE.md). Also, check out the [examples](https://github.com/TimonPost/crossterm/tree/master/crossterm_style/examples) folders with detailed examples for all functionality of this crate. All examples of how `crossterm_style` works can be found in the [examples](https://github.com/crossterm-rs/crossterm/tree/master/examples) directory.
Add the `crossterm_style` package to your `Cargo.toml` file. Add the `crossterm_style` package to your `Cargo.toml` file.
@ -60,7 +60,7 @@ pub use crossterm_style::{color, style, Attribute, Color, ColorType, ObjectStyle
- [Documentation](https://docs.rs/crossterm_input/) - [Documentation](https://docs.rs/crossterm_input/)
- [Crates.io](https://crates.io/crates/crossterm_input) - [Crates.io](https://crates.io/crates/crossterm_input)
- [Book](https://timonpost.github.io/crossterm/docs/styling.html) - [Book](https://crossterm-rs.github.io/crossterm/docs/styling.html)
- [Examples](./examples) - [Examples](./examples)
## Features ## Features
@ -75,10 +75,10 @@ These are the features of this crate:
- Background Color (16 base colors) - Background Color (16 base colors)
- 256 (ANSI) Color Support (Windows 10 and UNIX Only) - 256 (ANSI) Color Support (Windows 10 and UNIX Only)
- RGB Color Support (Windows 10 and UNIX only) - RGB Color Support (Windows 10 and UNIX only)
- Text Attributes: bold, italic, underscore and crossed word and [more](https://timonpost.github.io/crossterm/docs/styling.html#attributes) (Windows 10 and UNIX only) - Text Attributes: bold, italic, underscore and crossed word and [more](https://crossterm-rs.github.io/crossterm/docs/styling.html#attributes) (Windows 10 and UNIX only)
## Examples ## Examples
The [examples](https://github.com/TimonPost/crossterm/tree/master/examples) folder has more complete and verbose examples. The [examples](https://github.com/crossterm-rs/crossterm/tree/master/examples) folder has more complete and verbose examples.
_style text with attributes_ _style text with attributes_
```rust ```rust

View File

@ -1,8 +1,21 @@
# Changes crossterm_style 0.2.2 # Changes crossterm_terminal 0.3.0
- `Terminal::terminal_size` to `Terminal::size`
- `Terminal::size()` returns `Result<(u16, u16)>`
- Return written bytes: [return-written-bytes]
- Synced all `i16` values for indexing: set size, get size, scrolling to `u16` values
- Synced set/get terminal size behaviour: [fixed-get-set-terminal-size]
- `ExecutableCommand::queue` returns `crossterm::Result`
- `QueueableCommand::queue` returns `crossterm::Result`
- Command API takes mutable self instead of self
[return-written-bytes]: https://github.com/crossterm-rs/crossterm/pull/212
[fixed-get-set-terminal-size]: https://github.com/crossterm-rs/crossterm/pull/242
# Changes crossterm_terminal 0.2.2
- Terminal size Linux was not 0-based. - Terminal size Linux was not 0-based.
- Made FreeBSD compile - Made FreeBSD compile
# Changes crossterm_style 0.2 # Changes crossterm_terminal 0.2
- Removed `Terminal:from_output()` - Removed `Terminal:from_output()`
# Changes crossterm_terminal 0.1 # Changes crossterm_terminal 0.1

View File

@ -1,9 +1,9 @@
[package] [package]
name = "crossterm_terminal" name = "crossterm_terminal"
version = "0.2.5" version = "0.3.0"
authors = ["T. Post"] authors = ["T. Post"]
description = "A cross-platform library for doing terminal related actions." description = "A cross-platform library for doing terminal related actions."
repository = "https://github.com/TimonPost/crossterm" repository = "https://github.com/crossterm-rs/crossterm"
documentation = "https://docs.rs/crossterm_terminal/" documentation = "https://docs.rs/crossterm_terminal/"
license = "MIT" license = "MIT"
keywords = ["terminal", "clear", "console", "crossterm", "size"] keywords = ["terminal", "clear", "console", "crossterm", "size"]
@ -12,12 +12,12 @@ readme = "README.md"
edition = "2018" edition = "2018"
[target.'cfg(windows)'.dependencies] [target.'cfg(windows)'.dependencies]
crossterm_winapi = { path="../crossterm_winapi", version = "0.1.5"} crossterm_winapi = { path="../crossterm_winapi", version = "0.2.0"}
[target.'cfg(unix)'.dependencies] [target.'cfg(unix)'.dependencies]
libc = "0.2.51" libc = "0.2.51"
[dependencies] [dependencies]
crossterm_utils = { path="../crossterm_utils", version = "0.2.4"} crossterm_utils = { path="../crossterm_utils", version = "0.3.0"}
crossterm_cursor = {path="../crossterm_cursor", version = "0.2.5"} crossterm_cursor = { path="../crossterm_cursor", version = "0.3.0"}
serde = { version = "1.0.0", features = ["derive"], optional = true } serde = { version = "1.0.0", features = ["derive"], optional = true }

View File

@ -13,7 +13,7 @@
[s5]: https://img.shields.io/discord/560857607196377088.svg?logo=discord [s5]: https://img.shields.io/discord/560857607196377088.svg?logo=discord
[l5]: https://discord.gg/K4nyTDB [l5]: https://discord.gg/K4nyTDB
[s7]: https://travis-ci.org/TimonPost/crossterm.svg?branch=master [s7]: https://travis-ci.org/crossterm-rs/crossterm.svg?branch=master
This crate allows you to perform terminal related actions cross-platform e.g clearing, resizing etc. This crate allows you to perform terminal related actions cross-platform e.g clearing, resizing etc.
It supports all UNIX and windows terminals down to windows 7 (not all terminals are tested see [Tested Terminals](#tested-terminals) for more info) It supports all UNIX and windows terminals down to windows 7 (not all terminals are tested see [Tested Terminals](#tested-terminals) for more info)
@ -26,7 +26,7 @@ Other sub-crates are:
- [Crossterm Screen](https://crates.io/crates/crossterm_screen) - [Crossterm Screen](https://crates.io/crates/crossterm_screen)
- [Crossterm Cursor](https://crates.io/crates/crossterm_cursor) - [Crossterm Cursor](https://crates.io/crates/crossterm_cursor)
When you want to use other modules as well you might want to use crossterm with [feature flags](https://timonpost.github.io/crossterm/docs/feature_flags.html). When you want to use other modules as well you might want to use crossterm with [feature flags](https://crossterm-rs.github.io/crossterm/docs/feature_flags.html).
## Table of contents: ## Table of contents:
- [Getting started](#getting-started) - [Getting started](#getting-started)
@ -41,7 +41,7 @@ When you want to use other modules as well you might want to use crossterm with
## Getting Started ## Getting Started
This documentation is only for `crossterm_terminal` version `0.2` check the [examples](https://github.com/TimonPost/crossterm/tree/master/examples) folders with detailed examples for all functionality of this crate. All examples of how `crossterm_terminal` works can be found in the [examples](https://github.com/crossterm-rs/crossterm/tree/master/examples) directory.
Add the `crossterm_terminal` package to your `Cargo.toml` file. Add the `crossterm_terminal` package to your `Cargo.toml` file.
@ -77,12 +77,12 @@ These are the features of this crate:
## Command API ## Command API
My first recommendation is to use the [command API](https://timonpost.github.io/crossterm/docs/command.html) because this might replace some of the existing API in the future. My first recommendation is to use the [command API](https://crossterm-rs.github.io/crossterm/docs/command.html) because this might replace some of the existing API in the future.
Because it is more convenient, faster, and easier to use. Because it is more convenient, faster, and easier to use.
## Examples ## Examples
The [examples](https://github.com/TimonPost/crossterm/tree/master/examples) folder has more complete and verbose examples. The [examples](https://github.com/crossterm-rs/crossterm/tree/master/examples) folder has more complete and verbose examples.
```rust ```rust
use crossterm::terminal::{terminal,ClearType}; use crossterm::terminal::{terminal,ClearType};

View File

@ -1,9 +1,9 @@
[package] [package]
name = "crossterm_utils" name = "crossterm_utils"
version = "0.2.4" version = "0.3.0"
authors = ["T. Post"] authors = ["T. Post"]
description = "Common logic used by the crossterm crates." description = "Common logic used by the crossterm crates."
repository = "https://github.com/TimonPost/crossterm" repository = "https://github.com/crossterm-rs/crossterm"
documentation = "https://docs.rs/crossterm_utils/" documentation = "https://docs.rs/crossterm_utils/"
license = "MIT" license = "MIT"
keywords = ["terminal", "abstractions", "crossterm", "windows", "screen_buffer"] keywords = ["terminal", "abstractions", "crossterm", "windows", "screen_buffer"]
@ -12,8 +12,8 @@ readme = "README.md"
edition = "2018" edition = "2018"
[target.'cfg(windows)'.dependencies] [target.'cfg(windows)'.dependencies]
winapi = { version = "0.3.7", features = ["wincon"] } winapi = { version = "0.3.8", features = ["wincon"] }
crossterm_winapi = { path="../crossterm_winapi", version = "0.1.5"} crossterm_winapi = { path="../crossterm_winapi", version = "0.2.0"}
[target.'cfg(unix)'.dependencies] [target.'cfg(unix)'.dependencies]
libc = "0.2.51" libc = "0.2.51"

View File

@ -13,7 +13,7 @@
[s5]: https://img.shields.io/discord/560857607196377088.svg?logo=discord [s5]: https://img.shields.io/discord/560857607196377088.svg?logo=discord
[l5]: https://discord.gg/K4nyTDB. [l5]: https://discord.gg/K4nyTDB.
[s7]: https://travis-ci.org/TimonPost/crossterm.svg?branch=master [s7]: https://travis-ci.org/crossterm-rs/crossterm.svg?branch=master
This crate is a utilities crate used by the following [crossterm](https://crates.io/crates/crossterm) modules: This crate is a utilities crate used by the following [crossterm](https://crates.io/crates/crossterm) modules:
- [Crossterm Style](https://crates.io/crates/crossterm_style) - [Crossterm Style](https://crates.io/crates/crossterm_style)

View File

@ -8,7 +8,7 @@ use crate::{execute, impl_display, queue, write_cout, Result};
/// crossterm already delivers a number of commands. /// crossterm already delivers a number of commands.
/// There is no need to implement them yourself. /// There is no need to implement them yourself.
/// Also, you don't have to execute the commands yourself by calling a function. /// Also, you don't have to execute the commands yourself by calling a function.
/// For more information see the [command API](https://timonpost.github.io/crossterm/docs/command.html) /// For more information see the [command API](https://crossterm-rs.github.io/crossterm/docs/command.html)
pub trait Command { pub trait Command {
type AnsiType: Display; type AnsiType: Display;
@ -53,7 +53,7 @@ where
/// - When the buffer is to full, then the terminal will flush for you. /// - When the buffer is to full, then the terminal will flush for you.
/// - Incase of `stdout` each line, because `stdout` is line buffered. /// - Incase of `stdout` each line, because `stdout` is line buffered.
/// ///
/// Check the [command API](https://timonpost.github.io/crossterm/docs/command.html) for more information and all available commands. /// Check the [command API](https://crossterm-rs.github.io/crossterm/docs/command.html) for more information and all available commands.
/// ///
/// # Parameters /// # Parameters
/// - [Command](./trait.Command.html) /// - [Command](./trait.Command.html)
@ -83,7 +83,7 @@ where
/// In case you have many executions after on and another you can use `queue(command)` to get some better performance. /// In case you have many executions after on and another you can use `queue(command)` to get some better performance.
/// The `queue` function will not call `flush`. /// The `queue` function will not call `flush`.
/// ///
/// Check the [command API](https://timonpost.github.io/crossterm/docs/command.html) for more information and all available commands. /// Check the [command API](https://crossterm-rs.github.io/crossterm/docs/command.html) for more information and all available commands.
/// ///
/// # Remarks /// # Remarks
/// - In the case of UNIX and windows 10, ANSI codes are written to the given 'writer'. /// - In the case of UNIX and windows 10, ANSI codes are written to the given 'writer'.

View File

@ -34,7 +34,7 @@ macro_rules! write_cout {
/// - When the buffer is to full, then the terminal will flush for you. /// - When the buffer is to full, then the terminal will flush for you.
/// - Incase of `stdout` each line, because `stdout` is line buffered. /// - Incase of `stdout` each line, because `stdout` is line buffered.
/// ///
/// Check [here](https://timonpost.github.io/crossterm/docs/command.html) for more information and all availible commands. /// Check [here](https://crossterm-rs.github.io/crossterm/docs/command.html) for more information and all availible commands.
/// ///
/// # Parameters /// # Parameters
/// - [std::io::Writer](https://doc.rust-lang.org/std/io/trait.Write.html) /// - [std::io::Writer](https://doc.rust-lang.org/std/io/trait.Write.html)
@ -114,7 +114,7 @@ macro_rules! queue {
/// Execute one or more command(s) /// Execute one or more command(s)
/// ///
/// Check [here](https://timonpost.github.io/crossterm/docs/command.html) for more information and all availible commands. /// Check [here](https://crossterm-rs.github.io/crossterm/docs/command.html) for more information and all availible commands.
/// ///
/// # Parameters /// # Parameters
/// - [std::io::Writer](https://doc.rust-lang.org/std/io/trait.Write.html) /// - [std::io::Writer](https://doc.rust-lang.org/std/io/trait.Write.html)

View File

@ -0,0 +1,2 @@
# Changes crossterm_winapi 0.2.0
- `Console::get_handle` to `Console::handle`

View File

@ -1,9 +1,9 @@
[package] [package]
name = "crossterm_winapi" name = "crossterm_winapi"
version = "0.1.5" version = "0.2.0"
authors = ["T. Post"] authors = ["T. Post"]
description = "An WinApi wrapper that provides some basic simple abstractions aground common WinApi calls" description = "An WinApi wrapper that provides some basic simple abstractions aground common WinApi calls"
repository = "https://github.com/TimonPost/crossterm_winapi" repository = "https://github.com/crossterm-rs/crossterm"
documentation = "https://docs.rs/crossterm_winapi/" documentation = "https://docs.rs/crossterm_winapi/"
license = "MIT" license = "MIT"
keywords = ["winapi", "abstractions", "crossterm", "windows", "screen_buffer"] keywords = ["winapi", "abstractions", "crossterm", "windows", "screen_buffer"]
@ -12,7 +12,6 @@ readme = "README.md"
edition = "2018" edition = "2018"
[target.'cfg(windows)'.dependencies] [target.'cfg(windows)'.dependencies]
winapi = { version = "0.3.7", features = ["winbase","consoleapi","processenv", "handleapi"] } winapi = { version = "0.3.8", features = ["winbase","consoleapi","processenv", "handleapi"] }
[package.metadata.docs.rs] [package.metadata.docs.rs]
default-target = "x86_64-pc-windows-msvc" default-target = "x86_64-pc-windows-msvc"

View File

@ -10,10 +10,10 @@
[s3]: https://docs.rs/crossterm_winapi/badge.svg [s3]: https://docs.rs/crossterm_winapi/badge.svg
[l3]: https://docs.rs/crossterm_winapi/ [l3]: https://docs.rs/crossterm_winapi/
[s7]: https://travis-ci.org/TimonPost/crossterm.svg?branch=master [s7]: https://travis-ci.org/crossterm-rs/crossterm.svg?branch=master
This crate provides some wrappers aground common used WinApi functions. This crate provides some wrappers aground common used WinApi functions.
The purpose of this library is originally meant for [crossterm](https://github.com/TimonPost/crossterm), but could be used apart from it. The purpose of this library is originally meant for [crossterm](https://github.com/crossterm-rs/crossterm), but could be used apart from it.
Although, notice that it unstable right because some changes to the API could be expected. Although, notice that it unstable right because some changes to the API could be expected.
# Features # Features
@ -31,7 +31,7 @@ _The following WinApi calls_
- ReadConsoleW - ReadConsoleW
# Example # Example
The [examples](https://github.com/TimonPost/crossterm/tree/master/examples) folder has more complete and verbose examples. The [examples](https://github.com/crossterm-rs/crossterm/tree/master/examples) folder has more complete and verbose examples.
## Screenbuffer information ## Screenbuffer information
```rust ```rust

View File

@ -1,24 +1,93 @@
# Changes crossterm 0.10.0 # Changes crossterm 0.11.0
- Implemented command API, to have better performance and more control over how and when commands are executed. [PR](https://github.com/TimonPost/crossterm/commit/1a60924abd462ab169b6706aab68f4cca31d7bc2), [issue](https://github.com/TimonPost/crossterm/issues/171) As a preparation for crossterm 0.1.0 we have moved crossterm to an organisation called 'crossterm-rs'.
### Code Quality
- Code Cleanup: [warning-cleanup], [crossterm_style-cleanup], [crossterm_screen-cleanup], [crossterm_terminal-cleanup], [crossterm_utils-cleanup], [2018-cleanup], [api-cleanup-1], [api-cleanup-2], [api-cleanup-3]
- Examples: [example-cleanup_1], [example-cleanup_2], [example-fix], [commandbar-fix], [snake-game-improved]
- Fixed all broken tests and added tests
### Important Changes
- Return written bytes: [return-written-bytes]
- Added derives: `Debug` for `ObjectStyle` [debug-derive], Serialize/Deserialize for key events [serde]
- Improved error handling:
- Return `crossterm::Result` from all api's: [return_crossterm_result]
* `TerminalCursor::pos()` returns `Result<(u16, u16)>`
* `Terminal::size()` returns `Result<(u16, u16)>`
* `TerminalCursor::move_*` returns `crossterm::Result`
* `ExecutableCommand::queue` returns `crossterm::Result`
* `QueueableCommand::queue` returns `crossterm::Result`
* `get_available_color_count` returns no result
* `RawScreen::into_raw_mode` returns `crossterm::Result` instead of `io::Result`
* `RawScreen::disable_raw_mode` returns `crossterm::Result` instead of `io::Result`
* `AlternateScreen::to_alternate` returns `crossterm::Result` instead of `io::Result`
* `TerminalInput::read_line` returns `crossterm::Result` instead of `io::Result`
* `TerminalInput::read_char` returns `crossterm::Result` instead of `io::Result`
* Maybe I forgot something, a lot of functions have changed
- Removed all unwraps/expects from library
- Added KeyEvent::Enter and KeyEvent::Tab: [added-key-event-enter], [added-key-event-tab]
- Synced set/get terminal size behaviour: [fixed-get-set-terminal-size]
- Method renames:
* `AsyncReader::stop_reading()` to `stop()`
* `RawScreen::disable_raw_mode_on_drop` to `keep_raw_mode_on_drop`
* `TerminalCursor::reset_position()` to `restore_position()`
* `Command::get_anis_code()` to `ansi_code()`
* `available_color_count` to `available_color_count()`
* `Terminal::terminal_size` to `Terminal::size`
* `Console::get_handle` to `Console::handle`
- All `i16` values for indexing: set size, set cursor pos, scrolling synced to `u16` values
- Command API takes mutable self instead of self
[serde]: https://github.com/crossterm-rs/crossterm/pull/190
[debug-derive]: https://github.com/crossterm-rs/crossterm/pull/192
[example-fix]: https://github.com/crossterm-rs/crossterm/pull/193
[commandbar-fix]: https://github.com/crossterm-rs/crossterm/pull/204
[warning-cleanup]: https://github.com/crossterm-rs/crossterm/pull/198
[example-cleanup_1]: https://github.com/crossterm-rs/crossterm/pull/196
[example-cleanup_2]: https://github.com/crossterm-rs/crossterm/pull/225
[snake-game-improved]: https://github.com/crossterm-rs/crossterm/pull/231
[crossterm_style-cleanup]: https://github.com/crossterm-rs/crossterm/pull/208
[crossterm_screen-cleanup]: https://github.com/crossterm-rs/crossterm/pull/209
[crossterm_terminal-cleanup]: https://github.com/crossterm-rs/crossterm/pull/210
[crossterm_utils-cleanup]: https://github.com/crossterm-rs/crossterm/pull/211
[2018-cleanup]: https://github.com/crossterm-rs/crossterm/pull/222
[wild-card-cleanup]: https://github.com/crossterm-rs/crossterm/pull/224
[api-cleanup-1]: https://github.com/crossterm-rs/crossterm/pull/235
[api-cleanup-2]: https://github.com/crossterm-rs/crossterm/pull/238
[api-cleanup-3]: https://github.com/crossterm-rs/crossterm/pull/240
[return-written-bytes]: https://github.com/crossterm-rs/crossterm/pull/212
[return_crossterm_result]: https://github.com/crossterm-rs/crossterm/pull/232
[added-key-event-tab]: https://github.com/crossterm-rs/crossterm/pull/239
[added-key-event-enter]: https://github.com/crossterm-rs/crossterm/pull/236
[fixed-get-set-terminal-size]: https://github.com/crossterm-rs/crossterm/pull/242
# Changes crossterm 0.10.1
# Changes crossterm 0.10.0 ~ yanked
- Implemented command API, to have better performance and more control over how and when commands are executed. [PR](https://github.com/crossterm-rs/crossterm/commit/1a60924abd462ab169b6706aab68f4cca31d7bc2), [issue](https://github.com/crossterm-rs/crossterm/issues/171)
- Fixed showing, hiding cursor windows implementation - Fixed showing, hiding cursor windows implementation
- Removed some of the parsing logic from windows keys to ansi codes to key events [PR](https://github.com/TimonPost/crossterm/commit/762c3a9b8e3d1fba87acde237f8ed09e74cd9ecd) - Removed some of the parsing logic from windows keys to ansi codes to key events [PR](https://github.com/crossterm-rs/crossterm/commit/762c3a9b8e3d1fba87acde237f8ed09e74cd9ecd)
- Made terminal size 1-based [PR](https://github.com/TimonPost/crossterm/commit/d689d7e8ed46a335474b8262bd76f21feaaf0c50) - Made terminal size 1-based [PR](https://github.com/crossterm-rs/crossterm/commit/d689d7e8ed46a335474b8262bd76f21feaaf0c50)
- Added some derive implementation - Added some derive implementation
# Changes crossterm 0.9.6 # Changes crossterm 0.9.6
- Copy for KeyEvent - Copy for KeyEvent
- CTRL + Left, Down, Up, Right key support - CTRL + Left, Down, Up, Right key support
- SHIFT + Left, Down, Up, Right key support - SHIFT + Left, Down, Up, Right key support
- Fixed UNIX cursor position bug [issue](https://github.com/TimonPost/crossterm/issues/140), [PR](https://github.com/TimonPost/crossterm/pull/152) - Fixed UNIX cursor position bug [issue](https://github.com/crossterm-rs/crossterm/issues/140), [PR](https://github.com/crossterm-rs/crossterm/pull/152)
# Changes crossterm 0.9.5 # Changes crossterm 0.9.5
- Prefetching buffer size for more efficient windows input reads. [PR](https://github.com/TimonPost/crossterm/pull/144) - Prefetching buffer size for more efficient windows input reads. [PR](https://github.com/crossterm-rs/crossterm/pull/144)
# Changes crossterm 0.9.4 # Changes crossterm 0.9.4
- Reset foreground and background color individually. [PR](https://github.com/TimonPost/crossterm/pull/138) - Reset foreground and background color individually. [PR](https://github.com/crossterm-rs/crossterm/pull/138)
- Backtap input support. [PR](https://github.com/TimonPost/crossterm/pull/129) - Backtap input support. [PR](https://github.com/crossterm-rs/crossterm/pull/129)
- Corrected white/grey and added dark grey. - Corrected white/grey and added dark grey.
- Fixed getting cursor position with raw screen enabled. [PR](https://github.com/TimonPost/crossterm/pull/134) - Fixed getting cursor position with raw screen enabled. [PR](https://github.com/crossterm-rs/crossterm/pull/134)
- Removed one redundant stdout lock - Removed one redundant stdout lock
# Changes crossterm 0.9.3 # Changes crossterm 0.9.3
@ -67,7 +136,7 @@ This release is all about moving to a stabilized API for 1.0.
# Changes crossterm 0.7.0 # Changes crossterm 0.7.0
- Introduced more `Attributes` - Introduced more `Attributes`
- Introduced easier ways to style text [issue 87](https://github.com/TimonPost/crossterm/issues/87). - Introduced easier ways to style text [issue 87](https://github.com/crossterm-rs/crossterm/issues/87).
- Removed `ColorType` since it was unnecessary. - Removed `ColorType` since it was unnecessary.
# Changes crossterm 0.6.0 # Changes crossterm 0.6.0
@ -77,38 +146,38 @@ This release is all about moving to a stabilized API for 1.0.
- Less dependencies. - Less dependencies.
- Improved namespaces. - Improved namespaces.
[PR 84](https://github.com/TimonPost/crossterm/pull/84) [PR 84](https://github.com/crossterm-rs/crossterm/pull/84)
# Changes crossterm 0.5.5 # Changes crossterm 0.5.5
- Error module is made public [PR 78](https://github.com/TimonPost/crossterm/pull/78). - Error module is made public [PR 78](https://github.com/crossterm-rs/crossterm/pull/78).
# Changes crossterm 0.5.4 # Changes crossterm 0.5.4
- WinApi rewrite and correctly error handled [PR 67](https://github.com/TimonPost/crossterm/pull/67) - WinApi rewrite and correctly error handled [PR 67](https://github.com/crossterm-rs/crossterm/pull/67)
- Windows attribute support [PR 62](https://github.com/TimonPost/crossterm/pull/62) - Windows attribute support [PR 62](https://github.com/crossterm-rs/crossterm/pull/62)
- Readline bug fix windows systems [PR 62](https://github.com/TimonPost/crossterm/pull/62) - Readline bug fix windows systems [PR 62](https://github.com/crossterm-rs/crossterm/pull/62)
- Error handling improvement. - Error handling improvement.
- General refactoring, all warnings removed. - General refactoring, all warnings removed.
- Documentation improvement. - Documentation improvement.
# Changes crossterm 0.5.1 # Changes crossterm 0.5.1
- Documentation refactor. - Documentation refactor.
- Fixed broken API documentation [PR 53](https://github.com/TimonPost/crossterm/pull/53). - Fixed broken API documentation [PR 53](https://github.com/crossterm-rs/crossterm/pull/53).
# Changes crossterm 0.5.0 # Changes crossterm 0.5.0
- Added ability to pause the terminal [issue](https://github.com/TimonPost/crossterm/issues/39) - Added ability to pause the terminal [issue](https://github.com/crossterm-rs/crossterm/issues/39)
- RGB support for Windows 10 systems - RGB support for Windows 10 systems
- ANSI color value (255) color support - ANSI color value (255) color support
- More convenient API, no need to care about `Screen` unless working with when working with alternate or raw screen [PR](https://github.com/TimonPost/crossterm/pull/44) - More convenient API, no need to care about `Screen` unless working with when working with alternate or raw screen [PR](https://github.com/crossterm-rs/crossterm/pull/44)
- Implemented Display for styled object - Implemented Display for styled object
# Changes crossterm to 0.4.3 # Changes crossterm to 0.4.3
- Fixed bug [issue 41](https://github.com/TimonPost/crossterm/issues/41) - Fixed bug [issue 41](https://github.com/crossterm-rs/crossterm/issues/41)
# Changes crossterm to 0.4.2 # Changes crossterm to 0.4.2
- Added functionality to make a styled object writable to screen [issue 33](https://github.com/TimonPost/crossterm/issues/33) - Added functionality to make a styled object writable to screen [issue 33](https://github.com/crossterm-rs/crossterm/issues/33)
- Added unit tests. - Added unit tests.
- Bugfix with getting terminal size unix. - Bugfix with getting terminal size unix.
- Bugfix with returning written bytes [pull request 31](https://github.com/TimonPost/crossterm/pull/31) - Bugfix with returning written bytes [pull request 31](https://github.com/crossterm-rs/crossterm/pull/31)
- removed methods calls: `as_any()` and `as_any_mut()` from `TerminalOutput` - removed methods calls: `as_any()` and `as_any_mut()` from `TerminalOutput`
# Bug fix crossterm to 0.4.1 # Bug fix crossterm to 0.4.1
@ -133,10 +202,10 @@ Because you will have some work to get to the new version of crossterm depending
Some Features crossterm 0.3.0 Some Features crossterm 0.3.0
- Alternate Screen for windows and unix systems. - Alternate Screen for windows and unix systems.
- Raw screen for unix and windows systems [Issue 5](https://github.com/TimonPost/crossterm/issues/5).. - Raw screen for unix and windows systems [Issue 5](https://github.com/crossterm-rs/crossterm/issues/5)..
- Hiding an showing the cursor. - Hiding an showing the cursor.
- Control over blinking of the terminal cursor (only some terminals are supporting this). - Control over blinking of the terminal cursor (only some terminals are supporting this).
- The terminal state will be set to its original state when process ends [issue7](https://github.com/TimonPost/crossterm/issues/7). - The terminal state will be set to its original state when process ends [issue7](https://github.com/crossterm-rs/crossterm/issues/7).
- exit the current process. - exit the current process.
## Alternate screen ## Alternate screen
@ -166,12 +235,12 @@ With these modes you can easier design the terminal screen.
- Hiding and showing terminal cursor - Hiding and showing terminal cursor
- Enable or disabling blinking of the cursor for unix systems (this is not widely supported) - Enable or disabling blinking of the cursor for unix systems (this is not widely supported)
- Restoring the terminal to original modes. - Restoring the terminal to original modes.
- Added a [wrapper](https://github.com/TimonPost/crossterm/blob/master/src/shared/crossterm.rs) for managing all the functionalities of crossterm `Crossterm`. - Added a [wrapper](https://github.com/crossterm-rs/crossterm/blob/master/src/shared/crossterm.rs) for managing all the functionalities of crossterm `Crossterm`.
- Exit the current running process - Exit the current running process
## Examples ## Examples
Added [examples](https://github.com/TimonPost/crossterm/tree/master/examples) for each version of the crossterm version. Added [examples](https://github.com/crossterm-rs/crossterm/tree/master/examples) for each version of the crossterm version.
Also added a folder with some [real life examples](https://github.com/TimonPost/crossterm/tree/master/examples/program_examples). Also added a folder with some [real life examples](https://github.com/crossterm-rs/crossterm/tree/master/examples/program_examples).
## Context ## Context
@ -206,7 +275,7 @@ Also is this `Context` is a wrapper for access to the current console screen.
Because Crossterm needs access to the above to types quite often I have chosen to add those two in one struct called `Context` so that this type could be shared throughout library. Because Crossterm needs access to the above to types quite often I have chosen to add those two in one struct called `Context` so that this type could be shared throughout library.
Check this link for more info: [cleanup of rust code](https://stackoverflow.com/questions/48732387/how-can-i-run-clean-up-code-in-a-rust-library). Check this link for more info: [cleanup of rust code](https://stackoverflow.com/questions/48732387/how-can-i-run-clean-up-code-in-a-rust-library).
More info over writing to alternate screen buffer on windows and unix see this [link](https://github.com/TimonPost/crossterm/issues/17) More info over writing to alternate screen buffer on windows and unix see this [link](https://github.com/crossterm-rs/crossterm/issues/17)
__Now the user has to pass an context type to the modules of Crossterm like this:__ __Now the user has to pass an context type to the modules of Crossterm like this:__
@ -226,7 +295,7 @@ Because this looks a little odd I will provide a type withs will manage the `Con
### Alternate screen ### Alternate screen
When you want to switch to alternate screen there are a couple of things to keep in mind for it to work correctly. When you want to switch to alternate screen there are a couple of things to keep in mind for it to work correctly.
First off some code of how to switch to Alternate screen, for more info check the [alternate screen example](https://github.com/TimonPost/crossterm/blob/master/examples/alternate_screen.rs). First off some code of how to switch to Alternate screen, for more info check the [alternate screen example](https://github.com/crossterm-rs/crossterm/blob/master/examples/alternate_screen.rs).
_Create alternate screen from `Context`_ _Create alternate screen from `Context`_
@ -248,18 +317,18 @@ _Create alternate screen from `Crossterm`:_
like demonstrated above, to get the functionalities of `cursor(), color(), terminal()` also working on alternate screen. like demonstrated above, to get the functionalities of `cursor(), color(), terminal()` also working on alternate screen.
You need to pass it the same `Context` as you have passed to the previous three called functions, You need to pass it the same `Context` as you have passed to the previous three called functions,
If you don't use the same `Context` in `cursor(), color(), terminal()` than these modules will be using the main screen and you will not see anything at the alternate screen. If you use the [Crossterm](https://github.com/TimonPost/crossterm/blob/master/src/shared/crossterm.rs) type you can get the `Context` from it by calling the crossterm.get_context() whereafter you can create the AlternateScreen from it. If you don't use the same `Context` in `cursor(), color(), terminal()` than these modules will be using the main screen and you will not see anything at the alternate screen. If you use the [Crossterm](https://github.com/crossterm-rs/crossterm/blob/master/src/shared/crossterm.rs) type you can get the `Context` from it by calling the crossterm.get_context() whereafter you can create the AlternateScreen from it.
# Fixes in crossterm 0.2.2 # Fixes in crossterm 0.2.2
- Bug see [issue 15](https://github.com/TimonPost/crossterm/issues/15) - Bug see [issue 15](https://github.com/crossterm-rs/crossterm/issues/15)
# Fixes in crossterm 0.2.1 # Fixes in crossterm 0.2.1
- Default ANSI escape codes for windows machines, if windows does not support ANSI switch back to WinApi. - Default ANSI escape codes for windows machines, if windows does not support ANSI switch back to WinApi.
- method grammar mistake fixed [Issue 3](https://github.com/TimonPost/crossterm/issues/3) - method grammar mistake fixed [Issue 3](https://github.com/crossterm-rs/crossterm/issues/3)
- Some Refactorings in method names see [issue 4](https://github.com/TimonPost/crossterm/issues/4) - Some Refactorings in method names see [issue 4](https://github.com/crossterm-rs/crossterm/issues/4)
- Removed bin reference from crate [Issue 6](https://github.com/TimonPost/crossterm/issues/6) - Removed bin reference from crate [Issue 6](https://github.com/crossterm-rs/crossterm/issues/6)
- Get position unix fixed [issue 8](https://github.com/TimonPost/crossterm/issues/8) - Get position unix fixed [issue 8](https://github.com/crossterm-rs/crossterm/issues/8)
# Features crossterm 0.2 # Features crossterm 0.2

View File

@ -11,13 +11,13 @@ for Windows versions lower than 10. Crossterm uses WinAPI in this case.
The `crossterm` crate consists of 7 crates: The `crossterm` crate consists of 7 crates:
* [cursor](https://github.com/TimonPost/crossterm/tree/master/crossterm_cursor) * [cursor](https://github.com/crossterm-rs/crossterm/tree/master/crossterm_cursor)
* [input](https://github.com/TimonPost/crossterm/tree/master/crossterm_input) * [input](https://github.com/crossterm-rs/crossterm/tree/master/crossterm_input)
* [style](https://github.com/TimonPost/crossterm/tree/master/crossterm_style) * [style](https://github.com/crossterm-rs/crossterm/tree/master/crossterm_style)
* [terminal](https://github.com/TimonPost/crossterm/tree/master/crossterm_terminal) * [terminal](https://github.com/crossterm-rs/crossterm/tree/master/crossterm_terminal)
* [screen](https://github.com/TimonPost/crossterm/tree/master/crossterm_screen) * [screen](https://github.com/crossterm-rs/crossterm/tree/master/crossterm_screen)
* [utils](https://github.com/TimonPost/crossterm/tree/master/crossterm_utils) * [utils](https://github.com/crossterm-rs/crossterm/tree/master/crossterm_utils)
* [winapi](https://github.com/TimonPost/crossterm/tree/master/crossterm_winapi) * [winapi](https://github.com/crossterm-rs/crossterm/tree/master/crossterm_winapi)
### Module structure ### Module structure
@ -85,4 +85,4 @@ use super::ITerminalCursor;
The code must be warning free. It's quite hard to find an error if the build logs are polluted with warnings. The code must be warning free. It's quite hard to find an error if the build logs are polluted with warnings.
If you decide to silent a warning with (`#[allow(...)]`), please add a comment why it's required. If you decide to silent a warning with (`#[allow(...)]`), please add a comment why it's required.
Always consult the [Travis CI](https://travis-ci.org/TimonPost/crossterm/pull_requests) build logs. Always consult the [Travis CI](https://travis-ci.org/crossterm-rs/crossterm/pull_requests) build logs.

View File

@ -369,7 +369,7 @@ New: crossterm::cursor
``` ```
Method names that changed [Issue 4](https://github.com/TimonPost/crossterm/issues/4): Method names that changed [Issue 4](https://github.com/crossterm-rs/crossterm/issues/4):
``` ```
Old: ::crossterm::crossterm_cursor::get(); Old: ::crossterm::crossterm_cursor::get();

BIN
docs/crossterm_c.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

BIN
docs/crossterm_full.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

103
docs/crossterm_full.svg Normal file
View File

@ -0,0 +1,103 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
width="700.000000pt" height="433.000000pt" viewBox="0 0 700.000000 433.000000"
preserveAspectRatio="xMidYMid meet">
<metadata>
Created by potrace 1.15, written by Peter Selinger 2001-2017
</metadata>
<g transform="translate(0.000000,433.000000) scale(0.100000,-0.100000)"
fill="#000000" stroke="none">
<path d="M987 3178 c-41 -74 -41 -74 -90 -34 -63 52 -83 48 -112 -19 -14 -30
-27 -55 -30 -55 -3 0 -24 14 -47 30 -43 32 -79 38 -95 18 -6 -7 -13 -35 -17
-62 -3 -27 -8 -51 -11 -54 -2 -2 -22 3 -45 12 -89 35 -118 16 -106 -69 4 -24
3 -46 -2 -49 -6 -3 -35 -1 -67 6 -48 9 -59 9 -72 -5 -13 -13 -14 -22 -4 -61
19 -75 19 -75 -57 -78 -61 -3 -67 -5 -70 -26 -2 -13 4 -41 12 -63 25 -61 22
-66 -36 -74 -29 -4 -59 -12 -65 -17 -22 -18 -14 -53 22 -95 19 -23 35 -43 35
-46 0 -2 -12 -7 -27 -10 -47 -10 -93 -44 -93 -69 0 -13 18 -40 41 -64 l41 -42
-46 -27 c-42 -24 -46 -30 -46 -64 0 -33 5 -40 40 -60 22 -12 40 -25 40 -28 0
-2 -16 -23 -35 -46 -53 -61 -46 -86 28 -112 31 -11 57 -24 57 -30 0 -5 -14
-23 -31 -39 -60 -60 -45 -109 37 -119 25 -2 48 -7 51 -11 3 -3 -2 -25 -11 -49
-32 -86 -16 -113 63 -102 31 4 51 3 56 -4 3 -6 1 -37 -5 -67 -16 -78 -4 -90
74 -74 30 6 60 9 65 5 6 -3 7 -27 4 -55 -4 -33 -2 -55 7 -65 16 -19 57 -19 90
0 46 26 59 20 66 -36 12 -86 45 -100 108 -44 22 19 45 35 51 35 6 0 19 -26 30
-58 26 -75 52 -80 112 -22 l43 40 26 -42 c31 -50 41 -58 71 -58 16 0 31 15 54
53 l33 52 39 -42 c50 -54 77 -56 106 -8 11 20 24 47 27 60 8 31 14 31 48 0 71
-66 107 -57 121 32 4 26 9 51 11 55 3 4 23 -2 47 -12 52 -24 93 -25 101 -4 3
9 6 40 6 70 0 61 1 61 76 43 39 -10 48 -9 61 4 14 13 14 24 5 72 -7 32 -9 62
-6 67 4 6 25 7 50 3 63 -9 84 0 84 36 0 16 -7 46 -15 66 -8 19 -15 39 -15 44
0 5 23 11 51 15 85 11 99 43 49 112 -16 23 -30 45 -30 49 0 5 24 17 53 28 68
27 73 53 22 112 -19 23 -35 44 -35 47 0 2 22 17 50 33 41 23 50 33 50 55 0 22
-9 32 -50 54 -27 15 -50 32 -50 39 0 6 16 26 35 45 19 19 35 44 35 56 0 25
-40 59 -83 69 -15 4 -27 10 -27 14 0 3 14 24 30 45 32 42 38 77 18 94 -7 5
-37 13 -66 17 -43 6 -53 10 -49 24 40 138 39 141 -48 141 -36 0 -65 4 -65 9 0
5 5 32 12 61 10 44 9 53 -5 67 -14 14 -23 15 -67 5 -29 -7 -55 -12 -60 -12 -5
0 -10 30 -12 68 -3 65 -4 67 -31 70 -16 2 -46 -4 -68 -12 -22 -9 -43 -16 -48
-16 -5 0 -12 24 -16 53 -4 28 -12 58 -17 65 -17 20 -53 14 -97 -19 -24 -17
-44 -29 -44 -27 -59 121 -75 130 -137 74 -22 -20 -44 -36 -48 -36 -4 0 -21 23
-37 50 -37 62 -70 69 -98 18z m41 -398 c17 0 44 18 83 55 32 30 66 55 76 55
32 0 125 -31 186 -61 l57 -29 0 -88 c0 -62 -4 -94 -15 -109 l-15 -22 -44 19
c-90 40 -166 54 -301 54 -105 0 -145 -4 -210 -23 -197 -55 -335 -178 -386
-341 -29 -92 -28 -227 1 -315 12 -37 20 -68 19 -69 -10 -9 -107 -66 -112 -66
-6 0 -33 66 -53 130 -8 25 -17 95 -21 156 l-6 110 32 13 c17 8 31 17 31 21 0
4 12 11 28 15 52 13 72 33 72 73 0 20 -7 50 -15 65 -22 44 -29 117 -13 154 31
74 177 207 285 262 23 11 72 29 110 40 l68 19 59 -59 c41 -41 66 -59 84 -59z
m206 -307 c68 -22 133 -83 168 -160 l28 -63 85 0 85 0 0 40 c0 39 0 40 19 21
10 -10 33 -22 50 -26 17 -4 31 -10 31 -15 0 -5 15 -14 34 -21 33 -12 35 -14
38 -73 10 -156 -34 -309 -117 -411 -19 -23 -35 -45 -35 -48 0 -3 -12 -18 -27
-33 -26 -26 -28 -27 -88 -15 -120 22 -129 17 -151 -81 -8 -35 -16 -73 -19 -85
-11 -47 -251 -92 -387 -73 -40 6 -80 12 -88 15 -131 36 -129 35 -139 68 -6 18
-15 56 -21 86 -5 30 -15 60 -21 68 -14 16 -75 17 -135 2 -39 -10 -48 -9 -62 5
-19 19 -23 15 63 65 l49 29 31 -23 c46 -36 143 -81 215 -101 90 -25 328 -26
420 -1 204 55 336 187 348 350 l4 57 -85 0 -86 0 -7 -37 c-23 -130 -113 -200
-274 -217 -182 -18 -314 57 -356 201 -24 82 -16 259 15 328 66 148 229 206
415 148z"/>
<path d="M4557 2523 c-4 -3 -7 -17 -7 -30 0 -59 -47 -109 -116 -123 -53 -11
-54 -12 -54 -46 l0 -34 50 0 50 0 0 -135 c0 -75 5 -145 11 -158 16 -36 64 -59
133 -64 115 -10 158 27 172 145 l7 62 -46 0 -46 0 -3 -47 c-3 -41 -6 -48 -25
-51 -23 -3 -23 -2 -23 122 l0 126 60 0 60 0 0 40 0 40 -60 0 -60 0 0 80 0 80
-48 0 c-27 0 -52 -3 -55 -7z"/>
<path d="M2258 2373 l-118 -4 0 -39 c0 -36 2 -39 33 -42 l32 -3 3 -132 3 -133
-36 0 c-34 0 -35 -1 -35 -40 l0 -40 190 0 190 0 0 40 0 39 -57 3 -58 3 -3 84
c-3 94 7 131 46 161 34 28 42 25 42 -14 0 -44 22 -61 81 -61 63 0 94 28 94 85
0 57 -37 91 -104 98 -57 5 -134 -18 -151 -46 -7 -14 -9 -10 -10 16 0 20 -5 31
-12 30 -7 -1 -66 -4 -130 -5z"/>
<path d="M2867 2370 c-65 -17 -116 -49 -144 -92 -25 -37 -28 -51 -28 -124 0
-75 3 -86 30 -125 18 -26 50 -53 80 -68 44 -23 61 -26 160 -26 101 0 115 2
168 28 40 20 66 42 85 70 24 36 27 50 27 123 0 75 -3 86 -30 125 -45 64 -108
91 -220 95 -49 2 -107 -1 -128 -6z m137 -81 c34 -16 51 -62 50 -139 -1 -108
-45 -158 -115 -130 -36 15 -54 60 -54 135 0 113 47 166 119 134z"/>
<path d="M3418 2364 c-117 -36 -155 -161 -68 -226 15 -11 78 -29 148 -43 134
-27 142 -30 142 -50 0 -18 -34 -28 -87 -27 -61 0 -109 19 -137 53 -20 23 -33
29 -65 29 l-41 0 0 -80 0 -80 44 0 c24 0 46 5 48 11 3 8 20 6 58 -5 206 -61
407 55 335 193 -19 37 -63 57 -182 81 -142 29 -143 29 -143 44 0 21 57 37 104
30 52 -9 92 -29 106 -54 8 -15 21 -20 55 -20 l45 0 0 80 0 80 -39 0 c-24 0
-41 -5 -44 -14 -5 -13 -13 -13 -59 0 -67 17 -159 17 -220 -2z"/>
<path d="M3968 2363 c-66 -22 -100 -60 -106 -121 -8 -91 25 -115 213 -152 122
-24 137 -32 113 -56 -12 -12 -34 -17 -77 -16 -68 1 -125 23 -148 58 -12 18
-24 24 -54 24 l-39 0 0 -80 0 -80 38 0 c21 0 42 4 48 10 6 6 27 4 59 -6 113
-35 279 -1 328 68 26 35 26 101 0 136 -28 38 -55 49 -188 76 -63 13 -118 26
-122 29 -12 13 7 34 36 40 51 11 127 -11 158 -44 22 -23 36 -29 70 -29 l43 0
0 80 0 80 -39 0 c-21 0 -44 -6 -50 -14 -9 -11 -19 -11 -63 0 -68 18 -161 17
-220 -3z"/>
<path d="M5025 2371 c-125 -31 -199 -135 -180 -253 20 -117 99 -176 250 -185
162 -11 272 39 300 135 6 21 4 22 -47 22 -45 0 -55 -3 -63 -22 -16 -36 -53
-49 -123 -45 -69 3 -105 27 -117 80 l-7 27 181 0 181 0 0 38 c0 51 -41 134
-80 162 -17 12 -52 29 -77 36 -48 15 -167 17 -218 5z"/>
<path d="M5558 2373 l-118 -4 0 -39 c0 -37 2 -40 28 -40 51 0 53 -7 50 -141
l-3 -124 -32 -3 c-31 -3 -33 -6 -33 -43 l0 -39 190 0 190 0 0 40 0 40 -60 0
-60 0 0 103 0 103 33 32 c41 40 55 41 49 3 -10 -72 115 -97 165 -32 22 28 16
89 -11 116 -44 43 -148 46 -206 5 l-30 -21 0 25 c0 19 -5 25 -17 24 -10 -1
-71 -4 -135 -5z"/>
<path d="M6327 2366 c-20 -8 -44 -19 -52 -26 -13 -10 -15 -9 -15 9 0 20 -4 21
-130 21 l-130 0 0 -39 c0 -37 2 -40 33 -43 l32 -3 3 -132 3 -133 -36 0 c-34 0
-35 -1 -35 -40 l0 -40 160 0 160 0 0 39 c0 36 -3 40 -27 43 l-28 3 -3 106 c-3
119 5 135 69 145 60 10 73 -10 78 -115 4 -117 -2 -141 -34 -141 -22 0 -25 -4
-25 -40 l0 -40 150 0 150 0 0 39 c0 36 -3 40 -27 43 l-28 3 0 108 c0 102 1
110 24 128 29 24 72 24 100 2 20 -17 22 -26 19 -128 l-3 -110 -27 -3 c-25 -3
-28 -7 -28 -43 l0 -39 160 0 160 0 0 40 c0 39 -1 40 -34 40 -22 0 -36 6 -40
16 -3 9 -6 67 -6 129 0 130 -8 156 -59 188 -30 18 -50 22 -122 22 -76 0 -90
-3 -126 -27 -37 -25 -43 -26 -55 -11 -34 42 -153 56 -231 29z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

@ -1,5 +1,5 @@
Crossterm provides a way to work with the terminal input. We will not cover the basic usage but instead asynchronous and synchronous reading of input. Crossterm provides a way to work with the terminal input. We will not cover the basic usage but instead asynchronous and synchronous reading of input.
Please check out these [examples](https://github.com/TimonPost/crossterm/blob/master/examples/input.rs) for reading a line or a character from the user. Please check out these [examples](https://github.com/crossterm-rs/crossterm/blob/master/examples/input.rs) for reading a line or a character from the user.
## Differences Synchronous and Asynchronous ## Differences Synchronous and Asynchronous
Crossterm provides two ways to read user input, synchronous and asynchronous. Crossterm provides two ways to read user input, synchronous and asynchronous.
@ -128,4 +128,4 @@ fn main() {
} // <=== background reader will be disposed when dropped.s } // <=== background reader will be disposed when dropped.s
``` ```
--------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------
More robust and complete examples on all input aspects like mouse, keys could be found [here](https://github.com/TimonPost/crossterm/tree/master/examples/). More robust and complete examples on all input aspects like mouse, keys could be found [here](https://github.com/crossterm-rs/crossterm/tree/master/examples/).

View File

@ -40,4 +40,4 @@ _example of what I mean_
To start at the beginning of the next line, use `\n\r`. To start at the beginning of the next line, use `\n\r`.
--------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------
More examples could be found [over here](https://github.com/TimonPost/crossterm/blob/master/examples/). More examples could be found [over here](https://github.com/crossterm-rs/crossterm/blob/master/examples/).

View File

@ -21,7 +21,7 @@ There are 16 base colors which available for almost all terminals even windows 7
In addition to 16 colors, most UNIX terminals and Windows 10 consoles are also supporting more colors. In addition to 16 colors, most UNIX terminals and Windows 10 consoles are also supporting more colors.
Those colors could be: [True color (24-bit)](https://en.wikipedia.org/wiki/Color_depth#True_color_(24-bit)) coloring scheme, which allows you to use [RGB](https://nl.wikipedia.org/wiki/RGB-kleursysteem), and [256 (Xterm, 8-bit)](https://jonasjacek.github.io/colors/) colors. Those colors could be: [True color (24-bit)](https://en.wikipedia.org/wiki/Color_depth#True_color_(24-bit)) coloring scheme, which allows you to use [RGB](https://nl.wikipedia.org/wiki/RGB-kleursysteem), and [256 (Xterm, 8-bit)](https://jonasjacek.github.io/colors/) colors.
Checkout the [examples](https://github.com/TimonPost/crossterm/blob/master/examples/style.rs) on how to use this feature. Checkout the [examples](https://github.com/crossterm-rs/crossterm/blob/master/examples/style.rs) on how to use this feature.
## Attributes ## Attributes
Only UNIX and Windows 10 terminals are supporting attributes on top of the text. Crossterm allows you to add attributes to the text. Only UNIX and Windows 10 terminals are supporting attributes on top of the text. Crossterm allows you to add attributes to the text.
@ -148,5 +148,5 @@ Well, the trait `Styling`, who you need to include, is implemented for `&'static
When calling a method on any string crossterm transforms will transform it into a `StyledObject` who you could use in your write statements. When calling a method on any string crossterm transforms will transform it into a `StyledObject` who you could use in your write statements.
--------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------
More examples could be found at this [link](https://github.com/TimonPost/crossterm/blob/master/examples/style.rs). More examples could be found at this [link](https://github.com/crossterm-rs/crossterm/blob/master/examples/style.rs).

View File

@ -1,24 +1,24 @@
This folder contains examples for crossterm and it's the sub-crates. This folder contains examples for crossterm and it's the sub-crates.
When using a sub-crate instead of the crossterm crate, make sure to change the namespaces in the examples from `crossterm` to `crossterm_{crate_name}`. **When using a sub-crate instead of the crossterm crate, make sure to change the namespaces in the examples from `crossterm` to `crossterm_{crate_name}`.**
Examples, on the different functionalities Examples, on the different functionalities
- [crossterm style](https://crates.io/crates/crossterm_style) - [crossterm style](https://crates.io/crates/crossterm_style)
- [color](https://github.com/TimonPost/crossterm/blob/master/examples/cursor.rs): this is about the styling of the terminal - [color](https://github.com/crossterm-rs/crossterm/blob/master/examples/cursor.rs): this is about the styling of the terminal
- [crossterm input](https://crates.io/crates/crossterm_input) - [crossterm input](https://crates.io/crates/crossterm_input)
- [input](https://github.com/TimonPost/crossterm/blob/master/examples/input.rs): this is about input reading - [input](https://github.com/crossterm-rs/crossterm/blob/master/examples/input.rs): this is about input reading
- [key_events](https://github.com/TimonPost/crossterm/blob/master/examples/key_events.rs): this is about reading key events - [key_events](https://github.com/crossterm-rs/crossterm/blob/master/examples/key_events.rs): this is about reading key events
- [crossterm screen](https://crates.io/crates/crossterm_screen) - [crossterm screen](https://crates.io/crates/crossterm_screen)
- [alternate_screen](https://github.com/TimonPost/crossterm/blob/master/examples/alternate_screen.rs): this is about switching to an alternate screen buffer - [alternate_screen](https://github.com/crossterm-rs/crossterm/blob/master/examples/alternate_screen.rs): this is about switching to an alternate screen buffer
- [raw_screen](https://github.com/TimonPost/crossterm/blob/master/examples/raw_screen.rs): this is about enabling raw screen - [raw_screen](https://github.com/crossterm-rs/crossterm/blob/master/examples/raw_screen.rs): this is about enabling raw screen
- [crossterm cursor](https://crates.io/crates/crossterm_cursor) - [crossterm cursor](https://crates.io/crates/crossterm_cursor)
- [cursor](https://github.com/TimonPost/crossterm/blob/master/examples/cursor.rs): this is about the actions you can perform with the cursor - [cursor](https://github.com/crossterm-rs/crossterm/blob/master/examples/cursor.rs): this is about the actions you can perform with the cursor
- [crossterm terminal](https://crates.io/crates/crossterm_terminal) - [crossterm terminal](https://crates.io/crates/crossterm_terminal)
- [terminal](https://github.com/TimonPost/crossterm/blob/master/examples/terminal.rs): this is about the actions you can perform on the terminal - [terminal](https://github.com/crossterm-rs/crossterm/blob/master/examples/terminal.rs): this is about the actions you can perform on the terminal
Other Other
- [crossterm](https://github.com/TimonPost/crossterm/blob/master/examples/crossterm.rs): this is about the struct `Crossterm` - [crossterm](https://github.com/crossterm-rs/crossterm/blob/master/examples/crossterm.rs): this is about the struct `Crossterm`
- [command](https://github.com/TimonPost/crossterm/blob/master/examples/command.rs): this is about to the command api - [command](https://github.com/crossterm-rs/crossterm/blob/master/examples/command.rs): this is about to the command api
- [program examples](https://github.com/TimonPost/crossterm/tree/master/examples/program_examples): this folder will contain some real life examples - [program examples](https://github.com/crossterm-rs/crossterm/tree/master/examples/program_examples): this folder will contain some real life examples
- [command_bar](https://github.com/TimonPost/crossterm/tree/master/examples/command_bar): this is a terminal application where multiple threads write to the output while you can enter - [command_bar](https://github.com/crossterm-rs/crossterm/tree/master/examples/command_bar): this is a terminal application where multiple threads write to the output while you can enter
commands asynchronously. commands asynchronously.

View File

@ -6,7 +6,7 @@
//! //!
//! This crate supports all UNIX and Windows terminals down to Windows 7 (not all terminals are tested see [Tested Terminals](#tested-terminals) for more info). //! This crate supports all UNIX and Windows terminals down to Windows 7 (not all terminals are tested see [Tested Terminals](#tested-terminals) for more info).
//! //!
//! This crate consists of five modules that are provided behind [feature flags](https://timonpost.github.io/crossterm/docs/feature_flags.html) so that you can define which features you'd like to have; by default, all features are enabled. //! This crate consists of five modules that are provided behind [feature flags](https://crossterm-rs.github.io/crossterm/docs/feature_flags.html) so that you can define which features you'd like to have; by default, all features are enabled.
//! - [Crossterm Style](https://crates.io/crates/crossterm_style) //! - [Crossterm Style](https://crates.io/crates/crossterm_style)
//! - [Crossterm Input](https://crates.io/crates/crossterm_input) //! - [Crossterm Input](https://crates.io/crates/crossterm_input)
//! - [Crossterm Screen](https://crates.io/crates/crossterm_screen) //! - [Crossterm Screen](https://crates.io/crates/crossterm_screen)