Add Page Up/Page Down navigation to List and Checkbox - #725
Open
ChrisJr404 wants to merge 1 commit into
Open
Conversation
Long prompts already scroll one line at a time with the arrow keys, but there was no way to move faster through a big list. Handle PAGE_UP and PAGE_DOWN in both renderers to jump a full page (MAX_OPTIONS_DISPLAYED_AT_ONCE) at once, clamping at the ends and wrapping around when carousel is enabled so the behaviour matches the existing arrow keys. Closes magmax#674
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds Page Up / Page Down support to the List and Checkbox prompts, as requested in #674. Long menus already scroll one line at a time with the arrow keys, so paging through a big list is tedious; pressing Page Down (or Page Up) now jumps a full page at once.
I wired PAGE_UP and PAGE_DOWN into
process_inputfor both renderers, moving byMAX_OPTIONS_DISPLAYED_AT_ONCEand clamping at the first/last choice. Whencarouselis set they wrap around, matching how the arrow keys already behave, which also picks up on the pagination idea from the issue discussion. Defaults are untouched, so nothing changes for anyone who doesn't press those keys.Added integration tests covering paging forward and back, clamping at the ends, and the carousel wrap for both List and Checkbox, and noted the keys in the README next to the existing carousel docs.