mirror of
https://github.com/rivo/tview.git
synced 2026-04-26 21:35:54 +03:00
[PR #218] [CLOSED] Do not scroll List items unless selected item is out of view #882
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#882
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/rivo/tview/pull/218
Author: @ardnew
Created: 1/3/2019
Status: ❌ Closed
Base:
master← Head:list-viewtracking📝 Commits (1)
d3867f3change: implemented view tracking in List for more natural navigation📊 Changes
1 file changed (+41 additions, -16 deletions)
View changed files
📝
list.go(+41 -16)📄 Description
This change adds a single new field
viewOffsetto theListstruct because it is impossible (I'm pretty sure) to determine which items should be drawn at any given instant with only the state information available whenDraw()is called.This new
viewOffsetfield effectively remembers where the view existed the last timeDraw()was called, and from that along with the currently selected item, determines which items need to be drawn.Please test this out, it felt very natural to me, but I haven't looked to see if
TableorTreeViewwould also benefit from the same logic.This resolves issue #217
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.