Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Ratatui support #12

Closed
dzfrias opened this issue Mar 27, 2023 · 5 comments
Closed

Ratatui support #12

dzfrias opened this issue Mar 27, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@dzfrias
Copy link

dzfrias commented Mar 27, 2023

With the release of ratatui, it would be nice to have a feature flag or release of this crate that supports it!

https://github.com/tui-rs-revival/ratatui/releases

@rhysd rhysd added the enhancement New feature or request label Apr 5, 2023
@rhysd
Copy link
Owner

rhysd commented Apr 5, 2023

Yes, this should be supported. Though currently I don't have enough velocity to implement this, I'd like to work on this with higher priority when I have enough time.

@rhysd
Copy link
Owner

rhysd commented Apr 5, 2023

One thing I need to clarify is version of crossterm dependency.

  • tui-rs is depending on v0.25
  • ratatui is depending on v0.26

Currently tui-textarea is directly depending on v0.25 to align with tui-rs. I'm not sure we can switch the version of crossterm crate depending on tui-rs or ratatui respectively. I need to check if Cargo allows different versions of same crate to exist in dependencies list.

@rhysd
Copy link
Owner

rhysd commented Apr 6, 2023

I confirmed the following change worked.

diff --git a/Cargo.toml b/Cargo.toml
index b706d9a..2d8c2c0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -23,16 +23,19 @@ include = [

 [features]
 default = ["crossterm"]
-crossterm = ["dep:crossterm", "tui/crossterm"]
+crossterm = ["dep:crossterm-025", "tui/crossterm"]
 termion = ["dep:termion", "tui/termion"]
 search = ["dep:regex"]
+crossterm-ratatui = ["dep:crossterm-026", "ratatui/crossterm"]

 [dependencies]
-crossterm = { version = "0.25", optional = true }
+crossterm-025 = { package = "crossterm", version = "0.25", optional = true }
 regex = { version = "1", optional = true }
 termion = { version = "1.5", optional = true }
 tui = { version = "0.19", default-features = false }
 arbitrary = { version = "1", features = ["derive"], optional = true }
+crossterm-026 = { package = "crossterm", version = "0.26", optional = true }
+ratatui = { version = "0.20.1", default-features = false }

 [[example]]
 name = "minimal"

This means

I need to check if Cargo allows different versions of same crate to exist in dependencies list.

is possible.

Now I wonder how handle the combination of (tui, ratatui) * (crossterm, termion) with features of this crate. Current idea is adding the following features separate from original crossterm and termion features.

  • ratatui-crossterm
  • ratatui-termion

@rhysd
Copy link
Owner

rhysd commented Apr 13, 2023

I'm working on this in ratatui branch

@rhysd rhysd closed this as completed in 7754120 Apr 15, 2023
@rvigo
Copy link

rvigo commented Apr 27, 2023

Hi @rhysd, thanks for the ratatui support <3
Is it already available?

Just followed the instructions on README.md but got this error:

the package `X` depends on `tui-textarea`, with features: `ratatui-crossterm` but `tui-textarea` does not have these features.

Sorry if it is a silly question, I'm just not familiarized with Cargo releases

Additional Info:
Cargo.toml

crossterm = "0.26.1"
tui = { package = "ratatui", version = "0.20.1" }
tui-textarea = { version = "0.2.0",  features = ["ratatui-crossterm"], default-features = false }

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants