preiter93 / tui-widget-list

A widget list implementation for the ratatui ecosystem
MIT License
18 stars 5 forks source link

Feature Request: An option for how the top element is truncated #6

Closed akiomik closed 9 months ago

akiomik commented 9 months ago

Thank you for creating this awesome library!

As noted in the comments below, the top item may look a bit strange when the truncate option is enabled.

https://github.com/preiter93/tui-widget-list/blob/1fd8f81ee4006852411a22051c70986d05cce451/src/state.rs#L153-L155

If possible, it would be great if you could add an option to control the truncation of the top item.

akiomik commented 9 months ago

For reference, I am controlling this by adding a method to Listable that tells it that it is an item to be truncated. But, TBH, this is not a smart way.

https://github.com/preiter93/tui-widget-list/compare/main...akiomik:tui-widget-list:truncate-top

preiter93 commented 9 months ago

Hey, that was something I wanted to look into

I wonder if we can instead render the truncated element in a temporary buffer and then copy the rows from the temporary buffer over into the real buffer 🤔 I think I will take a look at it this weekend

preiter93 commented 9 months ago

@akiomik can you checkout https://github.com/preiter93/tui-widget-list/pull/7 if this is what you are looking for?

akiomik commented 9 months ago

Brilliant! It worked perfectly in the social client I am developing 💯

スクリーンショット 2024-01-12 10 24 06
preiter93 commented 9 months ago

great! The fix is published in 0.6.1

akiomik commented 9 months ago

Thank you for your kind cooperation😸