зеркало из
https://github.com/glebtv/tui-textarea.git
synced 2026-09-07 16:05:50 +03:00
rename your-backend features to no-backend
Этот коммит содержится в:
@@ -28,11 +28,11 @@ default = ["crossterm"]
|
|||||||
crossterm = ["dep:crossterm", "ratatui/crossterm"]
|
crossterm = ["dep:crossterm", "ratatui/crossterm"]
|
||||||
termion = ["dep:termion", "ratatui/termion"]
|
termion = ["dep:termion", "ratatui/termion"]
|
||||||
termwiz = ["dep:termwiz", "ratatui/termwiz"]
|
termwiz = ["dep:termwiz", "ratatui/termwiz"]
|
||||||
your-backend = ["ratatui"]
|
no-backend = ["dep:ratatui"]
|
||||||
# Features to use tui-rs
|
# Features to use tui-rs
|
||||||
tuirs-crossterm = ["dep:crossterm-025", "tui/crossterm"]
|
tuirs-crossterm = ["dep:crossterm-025", "tui/crossterm"]
|
||||||
tuirs-termion = ["dep:termion", "tui/termion"]
|
tuirs-termion = ["dep:termion", "tui/termion"]
|
||||||
tuirs-your-backend = ["tui"]
|
tuirs-no-backend = ["dep:tui"]
|
||||||
# Other optional features
|
# Other optional features
|
||||||
search = ["dep:regex"]
|
search = ["dep:regex"]
|
||||||
|
|
||||||
|
|||||||
14
README.md
14
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
|
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.
|
default features. The following table shows feature names corresponding to the dependencies.
|
||||||
|
|
||||||
| | crossterm | termion | termwiz | Your own backend |
|
| | crossterm | termion | termwiz | Your own backend |
|
||||||
|---------|----------------------------------|-----------------|-----------|----------------------|
|
|---------|----------------------------------|-----------------|-----------|--------------------|
|
||||||
| ratatui | `crossterm` (enabled by default) | `termion` | `termwiz` | `your-backend` |
|
| ratatui | `crossterm` (enabled by default) | `termion` | `termwiz` | `no-backend` |
|
||||||
| tui-rs | `tuirs-crossterm` | `tuirs-termion` | N/A | `tuirs-your-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][],
|
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
|
### Use your own backend
|
||||||
|
|
||||||
ratatui and tui-rs allows to make your own backend by implementing [`ratatui::backend::Backend`][ratatui-backend] trait.
|
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.
|
[tui-rs][]. They avoid adding backend crates (crossterm, termion, or termwiz) since you're using your own backend.
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# For ratatui
|
# For ratatui
|
||||||
tui-textarea = { version = "*", default-features = false, features = ["your-backend"] }
|
tui-textarea = { version = "*", default-features = false, features = ["no-backend"] }
|
||||||
# For tui-rs
|
# 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
|
`tui_textarea::Input` is a type for backend-agnostic key input. What you need to do is converting key event in your own
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ license = "MIT"
|
|||||||
bench = false
|
bench = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
tui-textarea = { path = "..", features = ["your-backend", "search"] }
|
tui-textarea = { path = "..", features = ["no-backend", "search"] }
|
||||||
ratatui = { version = "0.23.0", default-features = false }
|
ratatui = { version = "0.23.0", default-features = false }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
|||||||
@@ -3,14 +3,14 @@ use crate::ratatui::style::Style;
|
|||||||
feature = "crossterm",
|
feature = "crossterm",
|
||||||
feature = "termion",
|
feature = "termion",
|
||||||
feature = "termwiz",
|
feature = "termwiz",
|
||||||
feature = "your-backend",
|
feature = "no-backend",
|
||||||
))]
|
))]
|
||||||
use crate::ratatui::text::Line;
|
use crate::ratatui::text::Line;
|
||||||
use crate::ratatui::text::Span;
|
use crate::ratatui::text::Span;
|
||||||
#[cfg(any(
|
#[cfg(any(
|
||||||
feature = "tuirs-crossterm",
|
feature = "tuirs-crossterm",
|
||||||
feature = "tuirs-termion",
|
feature = "tuirs-termion",
|
||||||
feature = "tuirs-your-backend",
|
feature = "tuirs-no-backend",
|
||||||
))]
|
))]
|
||||||
use crate::ratatui::text::Spans as Line;
|
use crate::ratatui::text::Spans as Line;
|
||||||
use crate::util::{num_digits, spaces};
|
use crate::util::{num_digits, spaces};
|
||||||
|
|||||||
@@ -9,12 +9,12 @@
|
|||||||
feature = "crossterm",
|
feature = "crossterm",
|
||||||
feature = "termion",
|
feature = "termion",
|
||||||
feature = "termwiz",
|
feature = "termwiz",
|
||||||
feature = "your-backend"
|
feature = "no-backend",
|
||||||
),
|
),
|
||||||
any(
|
any(
|
||||||
feature = "tuirs-crossterm",
|
feature = "tuirs-crossterm",
|
||||||
feature = "tuirs-termion",
|
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");
|
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 = "crossterm",
|
||||||
feature = "termion",
|
feature = "termion",
|
||||||
feature = "termwiz",
|
feature = "termwiz",
|
||||||
feature = "your-backend",
|
feature = "no-backend",
|
||||||
))]
|
))]
|
||||||
#[allow(clippy::single_component_path_imports)]
|
#[allow(clippy::single_component_path_imports)]
|
||||||
use ratatui;
|
use ratatui;
|
||||||
#[cfg(any(
|
#[cfg(any(
|
||||||
feature = "tuirs-crossterm",
|
feature = "tuirs-crossterm",
|
||||||
feature = "tuirs-termion",
|
feature = "tuirs-termion",
|
||||||
feature = "tuirs-your-backend",
|
feature = "tuirs-no-backend",
|
||||||
))]
|
))]
|
||||||
use tui as ratatui;
|
use tui as ratatui;
|
||||||
|
|
||||||
|
|||||||
@@ -8,13 +8,13 @@ use crate::ratatui::style::{Color, Modifier, Style};
|
|||||||
feature = "crossterm",
|
feature = "crossterm",
|
||||||
feature = "termion",
|
feature = "termion",
|
||||||
feature = "termwiz",
|
feature = "termwiz",
|
||||||
feature = "your-backend",
|
feature = "no-backend",
|
||||||
))]
|
))]
|
||||||
use crate::ratatui::text::Line;
|
use crate::ratatui::text::Line;
|
||||||
#[cfg(any(
|
#[cfg(any(
|
||||||
feature = "tuirs-crossterm",
|
feature = "tuirs-crossterm",
|
||||||
feature = "tuirs-termion",
|
feature = "tuirs-termion",
|
||||||
feature = "tuirs-your-backend",
|
feature = "tuirs-no-backend",
|
||||||
))]
|
))]
|
||||||
use crate::ratatui::text::Spans as Line;
|
use crate::ratatui::text::Spans as Line;
|
||||||
use crate::ratatui::widgets::{Block, Widget};
|
use crate::ratatui::widgets::{Block, Widget};
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user