Proposal: Add SetRowsWithAnchor to Table for stable reverse pagination #872
iMithrellas
started this conversation in
Ideas
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.
-
I'm working on a TUI using
bubbles/tablethat involves reverse pagination (loading older items like chat history), and I've run into an issue where prepending rows causes the viewport to jump.Currently, SetRows doesn't account for the internal virtualization window shifting when the row count changes at the top. Manually patching YOffset is brittle because m.start (internal state) also shifts.
Proposed Solution:
I've implemented a
SetRowsWithAnchor(rows []Row, prepended int)method locally. It calculates the shift in the virtualization window and adjusts YOffset so the user's view remains stable.I have the implementation and tests ready. Would you be open to a PR for this?
You can see the implementation in my fork: https://github.com/iMithrellas/bubbles
Beta Was this translation helpful? Give feedback.
All reactions