tui-rs
tui-rs copied to clipboard
Give the crate::widgets::reflow module public visibility
I'm writing a new widget for tui-rs
ecosystem that I eventually plan to open-source.
But the new widget needs access to either the widgets::reflow
library, or copy the code.
Reuse seems like the better option to me.
Hey 👋 . This change is quite important in the sense it increases significantly the API surface of the crate and thus the maintenance cost. Could you provide more details on your needs ?
I think this is also somewhat linked to the missing ability to have the size of a text after being wrapped in Paragraph
. For example, a more flexible Text
object with wrapping and alignment capabilities might help you. I'll try to open an issue with a summary of possible solutions.
Hi there :smile:
Here's the use case:
I've written a TextEditor
widget for tui-rs
, which I'd like to open source and distribute via crates.io.
It supports the following features atm:
- Arbitrary multi-line cursor movement
- Arbitrary edits
- Emacs-style key bindings if so desired (opt-in via a build feature)
- Completely customizable key bindings if emacs-style bindings are not desired
In order to write it, I used the tui::widgets::Paragraph
type as an example, in particular impl StatefulWidget for Paragraph
.
The thing is, impl StatefulWidget for Paragraph
makes the exact same use of these 3 types as my TextEditor
widget does:
tui::widgets::reflow::{LineComposer, LineTruncator, WordWrapper}
I can understand if the APIs are not in a state to bluntly make them publicly available.
But it would be quite nice if I didn't have to patch the tui
dependency in my own projects, because that prevents publication on crates.io.
Perhaps while we sort out which parts of the API should be made public and which ones shouldn't, we could make them public-behind-a-feature-flag? It could be named something like unstable-reflow-api
or some such.