Add shortcuts to navigate Checkbox lists faster#259
Add shortcuts to navigate Checkbox lists faster#259solanav wants to merge 4 commits intotmbo:masterfrom
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! |
kiancross
left a comment
There was a problem hiding this comment.
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.
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.
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