MouseScrollUp/MouseScrollDown — mouse wheel events for TUI apps that can target specific co-ordinates #736
mikecsmith
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi — I recently built a TUI tool using BubbleTea (thanks!) that uses
MouseModeCellMotionto scroll content when the mouse wheel is over a given panel.I used
vhsto record some demos but found thatScrollUp/ScrollDowndon't provide a way to target a specific position on screen, so I couldn't scroll a particular panel in my TUI and couldn't get the scrolling smooth enough via 1 line scrolling key press events.I've taken a stab at fixing this by dispatching synthetic
WheelEvents on the xterm screen element with cell-based coordinates, so apps listening for SGR mouse input receive the scroll. The proposed syntax is:Scroll behaviour is configurable via two new settings:
Before I open a PR, I wanted to check:
MouseScrollUp/MouseScrollDowncommands), or would it be cleaner to fold this into the existingScrollUp/ScrollDown— e.g. by sending mouse wheel events when@col,rowcoordinates are provided and falling back to viewport scrolling when they're not?Happy to adjust the approach based on your preference.
Thanks,
Mike
Diff of implementation: mikecsmith@4e5e302
Video showing it in action:
scroll-variant-d.mp4
Beta Was this translation helpful? Give feedback.
All reactions