Open michirakara opened 1 week ago
There's a pretty long issue that we haven't really progressed on recently for defining how to wrap properly. https://github.com/ratatui-org/ratatui/issues/293. This fits in the "Support Character and Word boundaries" function I think.
I'd suggest as an immediate workaround to pre-wrap your text as needed. Consider whether the textwrap crate works for your use case. You could probably easily
QQ: How would you expect wrapping to work if the wrap point was in the middle of the ratatui word in the above case?
Thanks for the resource to textwrap crate! That worked for my case. By the way, it is expected to wrap to new line at the beginning of word "ratatui", but considering type of characters might be too complicated for a simple feature. For temporaly solution, just linking textwrap crate on docs could be useful for users.
For temporaly solution, just linking textwrap crate on docs could be useful for users.
Good idea :)
Problem
In Asian and many other languages, we usually don't put spaces between words, but we put spaces between words when there are numbers or alphabets. (for example:
私は ratatui が本当に便利だと思います
) When I use wrap feature in ratatui, this sentence would look like this.However, we usually change line not depending on spaces, and only depending on length of line, so it should look like
Solution
Add option to
ratatui::widgets::Paragraph::wrap
orratatui::widgets::Wrap
so that it doesn't care about spaces and only changes line when characters overflow from a line.Alternatives
N/A
Additional context
N/A