[GH-ISSUE #217] Do not scroll List items unless selected item is out of view #167

Closed
opened 2026-03-04 01:02:33 +03:00 by kerem · 1 comment
Owner

Originally created by @ardnew on GitHub (Jan 3, 2019).
Original GitHub issue: https://github.com/rivo/tview/issues/217

When navigating a List with more items than can fit on screen, the Draw routine tries to simulate a scrolling effect. However, this scrolling only works as expected in one direction -- when you scroll down.

When the user scrolls the list downward, the bottom-most item is highlighted/selected as the prior items scroll upward out of view as expected.

When the user scrolls the list upward, the bottom-most item is still highlighted/selected as the prior items scroll downward out of view, which is not what I think most people would expect.

For comparison, consider any given text editor. If your cursor is on the bottom-most row of the editor view, and you press the Up key on your keyboard, the cursor moves upward and the items visible on screen remain stationary until the cursor reaches the top of the screen -- at which point the whole relationship should happen in reverse.

Basically, unless the user's currently selected item is outside the range of visible items, the view should not be scrolling at all.

Originally created by @ardnew on GitHub (Jan 3, 2019). Original GitHub issue: https://github.com/rivo/tview/issues/217 When navigating a `List` with more items than can fit on screen, the `Draw` routine tries to simulate a scrolling effect. However, this scrolling only works as expected in one direction -- when you scroll down. When the user scrolls the list downward, the bottom-most item is highlighted/selected as the prior items scroll upward out of view _as expected_. When the user scrolls the list upward, the bottom-most item is _still_ highlighted/selected as the prior items scroll downward out of view, which is not what I think most people would expect. For comparison, consider any given text editor. If your cursor is on the bottom-most row of the editor view, and you press the `Up` key on your keyboard, the cursor moves upward and the items visible on screen remain stationary until the cursor reaches the top of the screen -- at which point the whole relationship should happen in reverse. Basically, unless the user's currently selected item is outside the range of visible items, the view should not be scrolling at all.
kerem closed this issue 2026-03-04 01:02:34 +03:00
Author
Owner

@rivo commented on GitHub (Jan 23, 2019):

See also https://github.com/rivo/tview/pull/218#issuecomment-456959828.

<!-- gh-comment-id:456959967 --> @rivo commented on GitHub (Jan 23, 2019): See also https://github.com/rivo/tview/pull/218#issuecomment-456959828.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tview#167
No description provided.