diff --git a/Cargo.toml b/Cargo.toml index 967fe59..30d2f07 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,11 +28,11 @@ default = ["crossterm"] crossterm = ["dep:crossterm", "ratatui/crossterm"] termion = ["dep:termion", "ratatui/termion"] termwiz = ["dep:termwiz", "ratatui/termwiz"] -your-backend = ["ratatui"] +no-backend = ["dep:ratatui"] # Features to use tui-rs tuirs-crossterm = ["dep:crossterm-025", "tui/crossterm"] tuirs-termion = ["dep:termion", "tui/termion"] -tuirs-your-backend = ["tui"] +tuirs-no-backend = ["dep:tui"] # Other optional features search = ["dep:regex"] diff --git a/README.md b/README.md index da403dd..d555694 100644 --- a/README.md +++ b/README.md @@ -171,10 +171,10 @@ tui-textarea = { version = "*", default-features = false, features = ["termwiz"] If you're using [tui-rs][] instead of [ratatui][], you need to enable features for using tui-rs crate and to disable default features. The following table shows feature names corresponding to the dependencies. -| | crossterm | termion | termwiz | Your own backend | -|---------|----------------------------------|-----------------|-----------|----------------------| -| ratatui | `crossterm` (enabled by default) | `termion` | `termwiz` | `your-backend` | -| tui-rs | `tuirs-crossterm` | `tuirs-termion` | N/A | `tuirs-your-backend` | +| | crossterm | termion | termwiz | Your own backend | +|---------|----------------------------------|-----------------|-----------|--------------------| +| ratatui | `crossterm` (enabled by default) | `termion` | `termwiz` | `no-backend` | +| tui-rs | `tuirs-crossterm` | `tuirs-termion` | N/A | `tuirs-no-backend` | For example, when you want to use the combination of [tui-rs][] and [crossterm][], @@ -563,15 +563,15 @@ match read()?.into() { ### Use your own backend ratatui and tui-rs allows to make your own backend by implementing [`ratatui::backend::Backend`][ratatui-backend] trait. -tui-textarea supports it as well. Please use `your-backend` feature for [ratatui][] or `tuirs-your-backend` feature for +tui-textarea supports it as well. Please use `no-backend` feature for [ratatui][] or `tuirs-no-backend` feature for [tui-rs][]. They avoid adding backend crates (crossterm, termion, or termwiz) since you're using your own backend. ```toml [dependencies] # For ratatui -tui-textarea = { version = "*", default-features = false, features = ["your-backend"] } +tui-textarea = { version = "*", default-features = false, features = ["no-backend"] } # For tui-rs -tui-textarea = { version = "*", default-features = false, features = ["tuirs-your-backend"] } +tui-textarea = { version = "*", default-features = false, features = ["tuirs-no-backend"] } ``` `tui_textarea::Input` is a type for backend-agnostic key input. What you need to do is converting key event in your own diff --git a/bench/Cargo.toml b/bench/Cargo.toml index fae3d8a..6bc5ec2 100644 --- a/bench/Cargo.toml +++ b/bench/Cargo.toml @@ -9,7 +9,7 @@ license = "MIT" bench = false [dependencies] -tui-textarea = { path = "..", features = ["your-backend", "search"] } +tui-textarea = { path = "..", features = ["no-backend", "search"] } ratatui = { version = "0.23.0", default-features = false } [dev-dependencies] diff --git a/src/highlight.rs b/src/highlight.rs index df9bad5..f5de743 100644 --- a/src/highlight.rs +++ b/src/highlight.rs @@ -3,14 +3,14 @@ use crate::ratatui::style::Style; feature = "crossterm", feature = "termion", feature = "termwiz", - feature = "your-backend", + feature = "no-backend", ))] use crate::ratatui::text::Line; use crate::ratatui::text::Span; #[cfg(any( feature = "tuirs-crossterm", feature = "tuirs-termion", - feature = "tuirs-your-backend", + feature = "tuirs-no-backend", ))] use crate::ratatui::text::Spans as Line; use crate::util::{num_digits, spaces}; diff --git a/src/lib.rs b/src/lib.rs index b7673a4..48e5fb5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -9,12 +9,12 @@ feature = "crossterm", feature = "termion", feature = "termwiz", - feature = "your-backend" + feature = "no-backend", ), any( feature = "tuirs-crossterm", feature = "tuirs-termion", - feature = "tuirs-your-backend" + feature = "tuirs-no-backend", ), ))] compile_error!("ratatui support and tui-rs support are exclussive. only one of them can be enabled at the same time. see https://github.com/rhysd/tui-textarea#installation"); @@ -35,14 +35,14 @@ mod word; feature = "crossterm", feature = "termion", feature = "termwiz", - feature = "your-backend", + feature = "no-backend", ))] #[allow(clippy::single_component_path_imports)] use ratatui; #[cfg(any( feature = "tuirs-crossterm", feature = "tuirs-termion", - feature = "tuirs-your-backend", + feature = "tuirs-no-backend", ))] use tui as ratatui; diff --git a/src/textarea.rs b/src/textarea.rs index c081ba1..f72bf6e 100644 --- a/src/textarea.rs +++ b/src/textarea.rs @@ -8,13 +8,13 @@ use crate::ratatui::style::{Color, Modifier, Style}; feature = "crossterm", feature = "termion", feature = "termwiz", - feature = "your-backend", + feature = "no-backend", ))] use crate::ratatui::text::Line; #[cfg(any( feature = "tuirs-crossterm", feature = "tuirs-termion", - feature = "tuirs-your-backend", + feature = "tuirs-no-backend", ))] use crate::ratatui::text::Spans as Line; use crate::ratatui::widgets::{Block, Widget};