ZIm/crates/ui/src
tims 8c92da45a9
terminal: Add scrollbar (#23256)
Closes #4798

This PR implements a scrollbar for the terminal by turning
`ScrollableHandle` into a trait, allowing us to implement a custom
scroll handle, `TerminalScrollHandle`. It works by converting terminal
lines into pixels that `ScrollableHandle` understands. When
`ScrollableHandle` provides a changed offset (e.g., when you drag the
scrollbar), we convert this pixel offset back into the number of lines
to scroll and update the terminal content accordingly.

While the current version works as expected, I believe the scrollbar's
offset updates could potentially be turned into an event. This event
could then be subscribed to in `TerminalView`, not needing to update the
terminal's offset in the `render` method as it might have performance
implications. Further ideas on this are welcome.

Preview:


https://github.com/user-attachments/assets/560f0aac-4544-4007-8f0b-8833386f608f

Todo:

- [x] Experiment with custom scrollbar responding to terminal mouse
scroll
- [x] Refactor existing scrollbar handle into a trait  
- [x] Update terminal to use the scrollbar trait instead of a custom
scrollbar implementation
- [x] Figure out how scrollbar events like mouse drag should notify the
terminal to update its state
- [x] Code clean up
- [x] Scrollbar hide setting for terminal

Release Notes:

- Added scrollbar to the terminal
2025-01-18 17:36:41 +01:00
..
components terminal: Add scrollbar (#23256) 2025-01-18 17:36:41 +01:00
styles ui: Track changes to UI font size made via actions with settings (#23265) 2025-01-16 23:28:18 +00:00
tests ui crate docs & spring cleaning (#18768) 2024-10-05 23:28:34 -04:00
traits Expose a theme preview keybinding function (#23237) 2025-01-16 11:43:56 -03:00
utils assistant2: Suggest recent files and threads as context (#22959) 2025-01-10 14:26:53 +00:00
components.rs Toggle & Switch (#21979) 2024-12-13 14:23:02 -05:00
prelude.rs Toggle & Switch (#21979) 2024-12-13 14:23:02 -05:00
styles.rs Improve experience when themes provide transparent status colors (#13996) 2024-07-09 11:27:47 -04:00
tests.rs ui crate docs & spring cleaning (#18768) 2024-10-05 23:28:34 -04:00
traits.rs Toggle & Switch (#21979) 2024-12-13 14:23:02 -05:00
ui.rs ui crate docs & spring cleaning (#18768) 2024-10-05 23:28:34 -04:00
utils.rs Toggle & Switch (#21979) 2024-12-13 14:23:02 -05:00