Skip to content

Add Page Up/Page Down navigation to List and Checkbox - #725

Open
ChrisJr404 wants to merge 1 commit into
magmax:mainfrom
ChrisJr404:page-up-down-navigation
Open

Add Page Up/Page Down navigation to List and Checkbox#725
ChrisJr404 wants to merge 1 commit into
magmax:mainfrom
ChrisJr404:page-up-down-navigation

Conversation

@ChrisJr404

Copy link
Copy Markdown

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_input for both renderers, moving by MAX_OPTIONS_DISPLAYED_AT_ONCE and clamping at the first/last choice. When carousel is 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.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant