gitui icon indicating copy to clipboard operation
gitui copied to clipboard

Refactor: Create ScrollableTextView component

Open MichaelAug opened this issue 1 year ago • 4 comments

Multiple UI elements have a text area with a vertical scroll bar. This can be refactored into a reusable component to reduce code duplication and improve UI consistency.

Tasks:

  1. Create ScrollableTextView component
  2. Refactor MsgPopup to use new component
  3. Refactor DetailsComponent to use new component

MichaelAug avatar Mar 25 '24 11:03 MichaelAug

Looks like we could use ratatui's built in Scrollbar widget instead of our custom one. This could simplify scroll_vertical.rs and scroll_horizontal.rs and probably remove scrollbar.rs entirely. Would you like this done?

Here's a comparison of the current scrollbar: old_scrollbar And the ratatui built in (default look): new_scrollbar

MichaelAug avatar Oct 12 '24 18:10 MichaelAug

I havent looked into the impact of this but i am all for simplifying and using a upstream solution where we can if it does not degrade performance

extrawurst avatar Oct 16 '24 09:10 extrawurst

I havent looked into the impact of this but i am all for simplifying and using a upstream solution where we can if it does not degrade performance

I think swapping the custom scrollbar with the ratatui one shouldn't be too difficult, I'll make a PR so we can test the changes

MichaelAug avatar Oct 17 '24 20:10 MichaelAug

I've made a small PR to test the scrollbar. You can see the new scrollbar in e.g. tag description or the file list. Looks like a lot of scrollable components don't use VerticalScroll. https://github.com/extrawurst/gitui/pull/2393

MichaelAug avatar Oct 20 '24 18:10 MichaelAug