prompt-toolkit / prompt-toolkit/python-prompt-toolkit
Overriding ProgressBar key bindings
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.6k
- Forks
- 815
- PR merge metrics
- No merged PRs in 30d
Description
So a progress bar has two sets of keybindings in use. The standard keybindings for "c-l" and "c-c" assigned to _ProgressControl (created by create_key_bindings):
and whatever keybindings the user provides which are passed to the Application.
https://github.com/prompt-toolkit/python-prompt-toolkit/blob/5ee9df2417f41d6d374b0a716156141061a8ac8f/prompt_toolkit/shortcuts/progress_bar/base.py#L187-L205
This means, for example, that I cannot overwrite the "c-c" keybinding. Why are there two 2 sets of key bindings and what would be the correct way to overwrite the bindings?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read the progress-bar key-binding setup in prompt_toolkit/shortcuts/progress_bar/base.py, especially the _ProgressControl bindings around lines 69-85 and 275-283 and the Application setup around lines 187-205. Trace how the two binding sets are combined, then establish how user-provided bindings should override the default c-c and c-l bindings. Done means the documented override behavior works without breaking the progress bar controls.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100