tui-rs
tui-rs copied to clipboard
manipulating ListState/TableState offset
Problem
The offset of ListState and TableState can neither be accessed nor manipulated.
Solution
Add publicly visible fn offset and fn offset_mut to both ListState and TableState.
Alternatives
None.
Additional context
Offset manipulation is needed to implement controls to center the view around the currently selected list item or row, e.g. like Emacs' recenter-top-bottom via C-l shortcut.
+1 for this, I'm looking for a way to get the offset value as well, so I can properly place a cursor on the active selection, which is not always obvious due to scrolling.
I'm looking for a way to get the offset value as well, so I can properly place a cursor on the active selection, which is not always obvious due to scrolling.
@Ranguna You can test this with the PR branch I made, which currently sits directly on top of v0.17.0:
[dependencies.tui]
git = "https://github.com/wookietreiber/tui-rs"
branch = "offset-manipulation"
My bad, PR #497 is better indeed.