-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add shortcuts to navigate Checkbox lists faster #259
base: master
Are you sure you want to change the base?
Conversation
Thanks for the PR, this looks great. Would you be able to add some unit tests? |
Done, tell me if you see something you want me to change! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay in reviewing this. I've left some questions/comments below.
|
||
@bindings.add(Keys.PageDown, eager=True) | ||
def move_cursor_down_fast(event): | ||
for _ in range(10): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does everything work correctly if there are fewer than 10 items? For example, if there are 9 items, page down should go to the 9th. Could you write a test for this?
for _ in range(10): | ||
ic.select_next() | ||
|
||
while not ic.is_selection_valid(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if you have a list with 1 valid item and 99 invalid items? In such a case, I think this might cause an infinite loop (unless ic.select_next()
loops around to the start of the list)? Can you write a test to cover this.
Great work thanks lot! I hacked the paging in my application. For example, for my use case I need to have 20 items in one page. Can we make 10 items dynamic and configurable? @solanav |
What is the problem that this PR addresses?
When offering a very long list of choices in the Checkbox question, traversing it is very slow.
How did you solve it?
I added four new bindings to the following keys:
Checklist