crosstermion-0.14.0/.cargo_vcs_info.json 0000644 00000000152 00000000001 0013643 0 ustar {
"git": {
"sha1": "3a96651033a3e8436e3836479420a3be65c1800a"
},
"path_in_vcs": "crosstermion"
} crosstermion-0.14.0/CHANGELOG.md 0000644 0000000 0000000 00000030236 10461020230 0014252 0 ustar 0000000 0000000 # Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## 0.14.0 (2024-02-03)
### Chore
- update ratatui to 0.26.0
### New Features (BREAKING)
- update ratatui to 0.26.0
### Commit Statistics
- 3 commits contributed to the release.
- 38 days passed between releases.
- 2 commits were understood as [conventional](https://www.conventionalcommits.org).
- 0 issues like '(#ID)' were seen in commit messages
### Commit Details
view details
* **Uncategorized**
- Release tui-react v0.23.0, safety bump crosstermion v0.14.0 ([`c85ae46`](https://github.com/Byron/tui-crates/commit/c85ae466b18d6a97ddb45a7e2dce632d25ef971b))
- Update ratatui to 0.26.0 ([`943d49d`](https://github.com/Byron/tui-crates/commit/943d49d47c04c4ddf36b6ade8652d234d2235961))
- Update ratatui to 0.26.0 ([`ca29ee1`](https://github.com/Byron/tui-crates/commit/ca29ee1037ed9a153c3d346c231e0562ee948467))
## 0.13.0 (2023-12-26)
### New Features (BREAKING)
- upgrade to `ratatui` v0.25
- Remove support for termion; use `crossterm` events directly.
Also remove custom Key/Event abstractions and use the ones provided
by `crossterm` instead. This is very much a breaking change,
but requires only mechanical adjustments.
### Commit Statistics
- 5 commits contributed to the release.
- 19 days passed between releases.
- 2 commits were understood as [conventional](https://www.conventionalcommits.org).
- 0 issues like '(#ID)' were seen in commit messages
### Commit Details
view details
* **Uncategorized**
- Release crosstermion v0.13.0 ([`9555c6f`](https://github.com/Byron/tui-crates/commit/9555c6ff4b431316151ce3b81dd182d077031ab8))
- Release tui-react v0.22.0, safety bump crosstermion v0.13.0 ([`b7283a5`](https://github.com/Byron/tui-crates/commit/b7283a511abadfdbbb6cfbb2832ee1d84c06815c))
- Merge branch 'remove-termion' ([`c69813f`](https://github.com/Byron/tui-crates/commit/c69813f00e114313b206bceaa838e2fe0954f37b))
- Upgrade to `ratatui` v0.25 ([`7b49dd8`](https://github.com/Byron/tui-crates/commit/7b49dd81a3f7c209279e90c1110de00dfd6a0701))
- Remove support for termion; use `crossterm` events directly. ([`2df671a`](https://github.com/Byron/tui-crates/commit/2df671a3b4e33e3c960c91e6c10f9e8fe6c94a11))
## 0.12.1 (2023-12-07)
### New Features
- replace `ansi-term` with `ansiterm`.
One is maintained, the other one is not.
### Commit Statistics
- 2 commits contributed to the release.
- 1 commit was understood as [conventional](https://www.conventionalcommits.org).
- 0 issues like '(#ID)' were seen in commit messages
### Commit Details
view details
* **Uncategorized**
- Release crosstermion v0.12.1 ([`7e7a324`](https://github.com/Byron/tui-crates/commit/7e7a324e094c121508adb1514b4aa39575f539aa))
- Replace `ansi-term` with `ansiterm`. ([`5533fe6`](https://github.com/Byron/tui-crates/commit/5533fe6db074b0ba132ea01df41bde45182a4933))
## 0.12.0 (2023-12-07)
### Chore
- upgrade all packages as long as they don't break the API
### Chore (BREAKING)
- upgrade `ratatui` to 0.24 and `crossterm` to v0.27.
Note that these two work together, and depend on each other.
### Commit Statistics
- 4 commits contributed to the release.
- 210 days passed between releases.
- 2 commits were understood as [conventional](https://www.conventionalcommits.org).
- 0 issues like '(#ID)' were seen in commit messages
### Commit Details
view details
* **Uncategorized**
- Release tui-react v0.21.0, crosstermion v0.12.0, safety bump crosstermion v0.12.0 ([`942f0b9`](https://github.com/Byron/tui-crates/commit/942f0b97a4b86b91e26530cca914906645f87ac4))
- Merge branch 'upgrades' ([`c6265c8`](https://github.com/Byron/tui-crates/commit/c6265c8773829f54e4acb1106d56ef2239edcab7))
- Upgrade `ratatui` to 0.24 and `crossterm` to v0.27. ([`a371272`](https://github.com/Byron/tui-crates/commit/a371272a96da49e8db82221eaf23d3aab38514d0))
- Upgrade all packages as long as they don't break the API ([`d337c86`](https://github.com/Byron/tui-crates/commit/d337c866f48dda83166d8cafaaa97bbf24d69216))
## 0.11.0 (2023-05-11)
### Chore (BREAKING)
- switch to 'ratatui' in a fashion that leaves imports alone.
However would still be a breaking change for anyone leaving `tui` in
their dependency tree.
### Commit Statistics
- 4 commits contributed to the release.
- 241 days passed between releases.
- 1 commit was understood as [conventional](https://www.conventionalcommits.org).
- 0 issues like '(#ID)' were seen in commit messages
### Commit Details
view details
* **Uncategorized**
- Release tui-react v0.20.0, crosstermion v0.11.0, safety bump crosstermion v0.11.0 ([`6cc6346`](https://github.com/Byron/tui-crates/commit/6cc634618e1549fcece860b7b43f5d7ee5d1d259))
- Merge branch 'ratatui-2' ([`948b539`](https://github.com/Byron/tui-crates/commit/948b5397c0b8317e857f79515165c04314b6838a))
- Further updates to `crossterm` and `termion` ([`3157b3b`](https://github.com/Byron/tui-crates/commit/3157b3bf392b18f0f6be7e2c04d0b8782d76314e))
- Switch to 'ratatui' in a fashion that leaves imports alone. ([`073005d`](https://github.com/Byron/tui-crates/commit/073005de8c9177248528a4cc9be58d6cee525394))
## 0.10.1 (2022-09-12)
### New Features
- Support for reseize events via the new `input_channel()` function.
Note that it only exists in blocking mode.
### Commit Statistics
- 3 commits contributed to the release.
- 1 commit was understood as [conventional](https://www.conventionalcommits.org).
- 0 issues like '(#ID)' were seen in commit messages
### Commit Details
view details
* **Uncategorized**
- Release crosstermion v0.10.1 ([`b1775e8`](https://github.com/Byron/tui-crates/commit/b1775e8da35f3df4f9e10af8f95b0931c1ee8d2b))
- Support for reseize events via the new `input_channel()` function. ([`509c64c`](https://github.com/Byron/tui-crates/commit/509c64c4918d7e1fbd462de5ec3ae83bf3329785))
- Cargo fmt ([`d31a4bd`](https://github.com/Byron/tui-crates/commit/d31a4bd53dde9db3160236ac132237f76513ad12))
## 0.10.0 (2022-09-12)
Upgrade to `tui` 0.19 and `crossterm` 0.25.
### Commit Statistics
- 4 commits contributed to the release.
- 231 days passed between releases.
- 0 commits were understood as [conventional](https://www.conventionalcommits.org).
- 0 issues like '(#ID)' were seen in commit messages
### Commit Details
view details
* **Uncategorized**
- Release crosstermion v0.10.0 ([`420d808`](https://github.com/Byron/tui-crates/commit/420d8087f49a87985d3331a384287481d43f1217))
- Update changelog prior to release ([`7e1330d`](https://github.com/Byron/tui-crates/commit/7e1330dfc070cd8c383d8b273622709e67a0c985))
- Upgrade to crossterm 25 and tui 19 ([`ec53e20`](https://github.com/Byron/tui-crates/commit/ec53e202e7fb1809b94de0b26a010f61704c6a74))
- Allow for the Resize event to happen ([`e49a08a`](https://github.com/Byron/tui-crates/commit/e49a08a9143e9d4684ffdf387face6cdb7b24367))
## 0.9.0 (2022-01-23)
### New Features (BREAKING)
- upgrade to tui 0.17
### Commit Statistics
- 4 commits contributed to the release.
- 170 days passed between releases.
- 1 commit was understood as [conventional](https://www.conventionalcommits.org).
- 0 issues like '(#ID)' were seen in commit messages
### Commit Details
view details
* **Uncategorized**
- Release crosstermion v0.9.0 ([`c5fc690`](https://github.com/Byron/tui-crates/commit/c5fc69022161e0abb2dd6c1402a606381ac2cce9))
- Upgrade to tui 0.17 ([`a3223b3`](https://github.com/Byron/tui-crates/commit/a3223b3d39cb71adb1b866653ee0c984924b90ca))
- Release tui-react v0.17.0 ([`4523678`](https://github.com/Byron/tui-crates/commit/4523678efbc9c876e46325682861c27ee5e7fb02))
- Use local tui-react crate ([`9281c8e`](https://github.com/Byron/tui-crates/commit/9281c8e65226ff3a34ade7b95ef96374c9a759ea))
## v0.8.1 (2021-08-05)
### Commit Statistics
- 3 commits contributed to the release over the course of 1 calendar day.
- 1 day passed between releases.
- 0 commits were understood as [conventional](https://www.conventionalcommits.org).
- 0 issues like '(#ID)' were seen in commit messages
### Commit Details
view details
* **Uncategorized**
- (cargo-release) version 0.8.1 ([`5fe230b`](https://github.com/Byron/tui-crates/commit/5fe230b6d85eaace655fad10ddac9608d2e62072))
- Fix apparently untested macr ([`c9ea9ac`](https://github.com/Byron/tui-crates/commit/c9ea9ac069ce7951252b3620052d611c925f6afd))
- Fix format ([`6323479`](https://github.com/Byron/tui-crates/commit/6323479162d69d22c55f4307be3eedd18c55f2af))
## v0.8.0 (2021-08-04)
* upgrade to TUI 0.16 and crossterm 0.20
### Commit Statistics
- 5 commits contributed to the release over the course of 93 calendar days.
- 0 commits were understood as [conventional](https://www.conventionalcommits.org).
- 0 issues like '(#ID)' were seen in commit messages
### Commit Details
view details
* **Uncategorized**
- Upgrade to crossterm 0.20 ([`1d31acb`](https://github.com/Byron/tui-crates/commit/1d31acbfde475ae42ac928d0e23ff950e669e2e7))
- Make CI work on windows ([`dc0e96f`](https://github.com/Byron/tui-crates/commit/dc0e96f982bf46c8b910ca316e92357c2091559b))
- Use a workspace ([`ccc5add`](https://github.com/Byron/tui-crates/commit/ccc5add08476a1910d8d78d3bb94b70237f50958))
- Changes repository paths in tui crates manifests ([`ac5c6e6`](https://github.com/Byron/tui-crates/commit/ac5c6e62c86189a72e2305d06da176821f88b180))
- Add tui crates ([`ccb6a24`](https://github.com/Byron/tui-crates/commit/ccb6a24315a7d881e50b24e98d4720406bff16d5))
## v0.7.0
* upgrade to TUI 0.15
## v0.4.0
* upgrade to TUI 0.12
## v0.3.2
* Remove `futures-util` dependency in favor of `futures-lite`
## v0.2.0
* remove native support for `flume` and `crossbeam-channel` for key input in favor of `std::sync::mpsc::Receiver`s :).
## v0.1.5
* support for simple cursor movements
* get terminal size
* color support to learn if color is allowed, and dynamically disable it
if `ansi_term` is used.
## v0.1.4
* Fix precendence of imports in 'terminal' module.
## v0.1.3
* `Key` type conversions are now always compiled when possible, as they are not mutually exclusive
## v0.1.2
* Enable `flume/select` by default and allow selecting `flume/async` via the `flume-async` feature.
## v0.1.1
* Add support for 'input-thread-flume' for using flume channels instead of crossbeam ones. They are
smaller and there is no unsafe code either, at the expense of lack of the 'select!()` capability.
## v0.1.0
Initial release.
crosstermion-0.14.0/Cargo.toml 0000644 00000004207 00000000001 0011646 0 ustar # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
#
# When uploading crates to the registry Cargo will automatically
# "normalize" Cargo.toml files for maximal compatibility
# with all versions of Cargo and also rewrite `path` dependencies
# to registry (e.g., crates.io) dependencies.
#
# If you are reading this file be aware that the original Cargo.toml
# will likely look very different (and much more reasonable).
# See Cargo.toml.orig for the original contents.
[package]
edition = "2018"
name = "crosstermion"
version = "0.14.0"
authors = ["Sebastian Thiel "]
include = [
"src/**/*",
"LICENSE.md",
"README.md",
"CHANGELOG.md",
]
description = "utilities for `crossterm`, without ties to `termion`"
readme = "README.md"
license = "MIT"
repository = "https://github.com/Byron/tui-crates"
[package.metadata.docs.rs]
all-features = true
[dependencies.ansiterm]
version = "0.12.2"
optional = true
default-features = false
[dependencies.async-channel]
version = "2.1.1"
optional = true
[dependencies.crossterm]
version = "0.27.0"
features = ["events"]
optional = true
default-features = false
[dependencies.futures-channel]
version = "0.3.5"
features = [
"std",
"sink",
]
optional = true
default-features = false
[dependencies.futures-core]
version = "0.3.5"
optional = true
default-features = false
[dependencies.futures-lite]
version = "2.1.0"
optional = true
[dependencies.tui]
version = "0.26.0"
optional = true
default-features = false
package = "ratatui"
[dependencies.tui-react]
version = "^0.23.0"
optional = true
default-features = false
[features]
color = ["ansiterm"]
default = []
input-async = [
"futures-channel",
"async-channel",
"futures-lite",
"futures-core",
]
input-async-crossterm = [
"crossterm/event-stream",
"input-async",
]
tui-crossterm = [
"tui",
"tui-crossterm-backend",
"crossterm",
]
tui-crossterm-backend = ["tui/crossterm"]
tui-react-crossterm = [
"tui-react",
"tui",
"tui-crossterm-backend",
"crossterm",
]
[target."cfg(windows)".dependencies.crossterm]
version = "0.27.0"
features = ["windows"]
optional = true
default-features = false
crosstermion-0.14.0/Cargo.toml.orig 0000644 0000000 0000000 00000003115 10461020230 0015324 0 ustar 0000000 0000000 [package]
name = "crosstermion"
version = "0.14.0"
authors = ["Sebastian Thiel "]
description = "utilities for `crossterm`, without ties to `termion`"
edition = "2018"
license = "MIT"
repository = "https://github.com/Byron/tui-crates"
readme = "README.md"
include = ["src/**/*", "LICENSE.md", "README.md", "CHANGELOG.md"]
[features]
default = []
color = ["ansiterm"]
input-async = ["futures-channel", "async-channel", "futures-lite", "futures-core" ]
input-async-crossterm = ["crossterm/event-stream", "input-async"]
tui-crossterm = ["tui", "tui-crossterm-backend", "crossterm"]
tui-react-crossterm = ["tui-react", "tui", "tui-crossterm-backend", "crossterm"]
tui-crossterm-backend = ["tui/crossterm"]
[dependencies]
crossterm = { version = "0.27.0", optional = true, default-features = false, features = ["events"] }
futures-channel = { version = "0.3.5", optional = true, default-features = false, features = ["std", "sink"] }
futures-core = { version = "0.3.5", optional = true, default-features = false }
futures-lite = { version = "2.1.0", optional = true }
tui = { package = "ratatui", version = "0.26.0", optional = true, default-features = false }
tui-react = { version = "^0.23.0", optional = true, default-features = false, path = "../tui-react" }
ansiterm = { version = "0.12.2", optional = true, default-features = false }
async-channel = { version = "2.1.1", optional = true }
[target."cfg(windows)".dependencies]
crossterm = { version = "0.27.0", optional = true, default-features = false, features = ["windows"] }
[package.metadata.docs.rs]
all-features = true
crosstermion-0.14.0/LICENSE.md 0000644 0000000 0000000 00000002133 10461020230 0014040 0 ustar 0000000 0000000 The MIT License (MIT)
=====================
Copyright © `2020` `Sebastian Thiel`
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
crosstermion-0.14.0/README.md 0000644 0000000 0000000 00000007216 10461020230 0013722 0 ustar 0000000 0000000
Crosstermion is a utility crate to unify some types of both crates, allowing to easily build apps that use the leaner `termion`
crate on unix systems, but resort to crossterm on windows systems.
Currently provided facilities are:
* a `Key` type an an `input_stream` (_async_) to receive key presses
* an `AltenrativeRawTerminal` which marries an alternative screen with raw mode
* a way to create a `tui` or `tui-react` terminal with either the crossterm or the termion backend.
### But how to do colors and styles?
* **With** `tui`
* When using the `tui`, you will have native cross-backend support for colors and styles.
* **Without** `tui`
* Use the **`color`** feature for additional utilities for colors with `ansi_term`.
* Otherwise, using `ansi_term`, `colored` or `termcolor` will work as expected.
### How to build with `crossterm` on Windows and `termion` on Unix?
There seems to be no easy way, as `cargo` will always build dependencies even though they are not supposed to be used on your platform.
This leads to both `termion` and `crossterm` to be built, which is fatal on Windows. Thus one will have to manually select feature toggles
when creating a release build, i.e. one would have to exclude all functionality that requires TUIs by default, and let the user enable
the features they require.
The `compile_error!(…)` macro can be useful to inform users if feature selection is required. Alternatively, assure that everything compiles
even without any selected backend.
Lastly, one can always give in and always compile against `crossterm`.
### Features
All features work additively, but in case they are mutually exclusive, for instance
in case of `tui-react` and `tui`, or `crossterm` and `termion`, the more general one will be chosen.
* _mutually exclusive_
* **crossterm**
* provides `Key` conversion support from `crossbeam::event::KeyEvent` and an `AlternativeRawTerminal`
* provides a threaded key input channel
* _additive_
* **input-async-crossterm**
* adds native async capabilites to crossterm, which works without spawning an extra thread thanks to `mio`.
* note that threaded key input is always supported.
* **termion**
* provides `Key` conversion support from `termion::event::Key` and an `AlternativeRawTerminal`
* provides a threaded key input channel
* _additive_
* **input-async**
* Spawn a thread and provide input events via a futures Stream
* note that threaded key input is always supported.
* _mutually exclusive_
* _using `tui_` _(mutually exclusive)_
* **tui-termion** _implies `termion` feature_
* combines `tui` with `termion` and provides a `tui::Terminal` with `termion` backend
* **tui-crossterm** _implies `crossterm` feature_
* combines `tui` with `crossterm` and provides a `tui::Terminal` with `crossterm` backend
* _using `tui-react`_ _(mutually exclusive)_
* **tui-react-termion** _implies `termion` feature_
* combines `tui-react` with `crossterm` and provides a `tui::Terminal` with `crossterm` backend
* **tui-react-crossterm** _implies `crossterm` feature_
* combines `tui-react` with `crossterm` and provides a `tui::Terminal` with `crossterm` backend
* **color**
* Add support for `ansi_term` based conditional coloring. The crate is small, to the point and allows zero-copy drawing
of bytes and UTF-8 string, while supporting Windows 10 as well.
* _cursor movement_
* _mutually exclusive_
* **crossterm**
* Implements cursor movement with crossterm
* **termion**
* Implements cursor movement with termion
crosstermion-0.14.0/src/color.rs 0000644 0000000 0000000 00000004233 10461020230 0014712 0 ustar 0000000 0000000 use std::borrow::Cow;
use std::ffi::OsStr;
#[cfg(feature = "ansiterm")]
mod _impl {
use ansiterm::{ANSIGenericString, Style};
pub struct Brush {
may_paint: bool,
style: Option