8000 Added cycle_list param and function in Checkbox prompt (issue #442) & Added 2 test cases by AnkushRoy7926 · Pull Request #443 · tmbo/questionary · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Added cycle_list param and function in Checkbox prompt (issue #442) & Added 2 test cases #443

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

AnkushRoy7926
Copy link

What is the problem that this PR addresses?

Issue #442

By default, the checkbox prompt in Questionary wraps the cursor from the last item back to the first (and vice versa). In long lists this can be disorienting—overshooting your target immediately jumps you to the other end. There wasn’t a built-in way to disable this “infinite carousel” behavior.

How did I solve it?

  • Introduced a new cycle_list: bool parameter on the checkbox() prompt (defaults to True to preserve existing behavior).

  • Updated the internal cursor-movement handlers (move_cursor_down / move_cursor_up) to check cycle_list. When cycle_list=False, attempts to move past the first or last item simply do nothing, rather than wrap.

  • Added docstring entries for cycle_list.

  • Wrote automated tests covering both cycle_list=True (wraps) and cycle_list=False (does not wrap) in the tests/prompts/test_checkbox_cycle.py.

Checklist

  • I have read the Contributor's Guide.
  • I will check that all automated PR checks pass before the PR gets reviewed.

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
0