Open darkhz opened 6 months ago
I don't think this will be added any time soon. Most widgets, especially text views and text areas, don't know their entire content, much less a laid out version of it. They gradually parse and layout text as the user navigates to it. Tables can also be "infinitely" large, see https://github.com/rivo/tview/blob/master/demos/table/virtualtable/main.go for an example. If we wanted to show scrollbars for a text view, for example, we'd have to parse its entire text first, including any style/region tags and word wrapping. This would be a huge performance hit on large texts. (Actually, it was like this in beginning and lots of people complained about bad performance.)
I have plans to add functionality that might make it easier for you to add something like this yourself, however. Can't say right now, though, when this will be available.
@darkhz @rivo My fork has the ability to handle the scrollbars on any item you wish. While i do not haave a decent PR/patch to allow for easy integration into what your use case/code you should beable to trrack down the needed bits to make it work for integrating with your tview
Here is a few links of where you can see my fork implementing the DrawOverflow
function which handles the scrollbars.
you can see look into how they handle those calls, to generate scrollbars based on their current location and the total listings/etc.
https://github.com/digitallyserviced/tview/blob/611a26b9bad195005135a6ce0215280c68d57903/box.go#L833
Here is a gif where you can see the scrollbar being used in many different widgets... Lists, treeviews, tables, the pop-up animated context menus (a custom List element).
forgive the speed of it, but you can see how my fork implements up and down arrows and also handling the size of the bar based on the ratio of the content.
It would be good if scroll bars were shown for tables and textviews, so that the user can be notified about the position of the content and if there is any remaining content to be scrolled to.