tui-rs
tui-rs copied to clipboard
Line breaks not rendered properly in List and SelectableList
When using a List or SelectableList, if an item contain newlines, text after the newline will get overwritten by the next items.
For example:
SelectableList::default()
.items(&["Hey\nYou",":O:O:O"])
.render(&mut f, size);
Renders as:
Hey
:O:O:O
When it should be rendered as:
Hey
You
:O:O:O
I don't know how I feel about that. The current behavior is what I had in mind, i.e: 1 item = 1 line. Thus, this is more about supporting multi-line items in lists which will imply a bit of rework on the layout computation, styling, indexing, etc. Is that what you had in mind ?
I understand if you wish to leave it to 1 item = 1 line, but it should at least be newline aware and perhaps truncate the output if there are newlines.
As it is currently text from the previous item can overflow to the next items.
For example:
items(&["Hey\n\nYou",":O:O:O"])
will overflow and get rendered as
Hey
:O:O:O
You
First of all. Tui is an awesome tool and thank you for all of your hard work. I too would like to have the capability for multi-line ListItems