This repository has been archived by the owner on Aug 6, 2023. It is now read-only.
When scrolling text, how to tell when the end is reached #633
Unanswered
rosscanning
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm rendering a Paragraph widget with a wall of text. I process the PageUp and PageDown keys to set the 'scroll' of the widget, so the user can scroll up and down. Works nicely.
Problem is, how can I tell when the user has reached the bottom of the text? I would like to disable PageDown at that point, so the user can't keep scrolling down into blankness.
Poking around in the code, it seems like
Paragraph::render()
has the info I need. If I knew how this rendering loop:tui-rs/src/widgets/paragraph.rs
Line 175 in a6b25a4
exited (i.e., it ran out of lines or
break
ed out) I would know whether to enable PageDown or not. But this info is not exposed anywhere.Ideally,
render()
would return this information, but that's far too big a change. My vague plan to fix this is to add a 'last_render_result' field to Paragraph, that tells you how the most recent render ended. Does that sound like something that you might accept?Beta Was this translation helpful? Give feedback.
All reactions