prompt-toolkit / prompt-toolkit/python-prompt-toolkit
Keybinding ctrl-shift-<letter> doesn't work
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.6k
- Forks
- 815
- PR merge metrics
- No merged PRs in 30d
Description
The documentation indicates it should be possible to keybind ctrl+<uppercase letter>, but in practice I haven't been able to get it to work.
Traceback (most recent call last):
File "app.py", line 10, in <module>
from app.keybindings import keybindings
File "/Users/user/code/cli-app/app/keybindings.py", line 43, in <module>
@keybindings.add('c-Y')
File "/Users/user/code/cli-app/env/lib/python3.7/site-packages/prompt_toolkit/key_binding/key_bindings.py", line 188, in add
keys = tuple(_check_and_expand_key(k) for k in keys)
File "/Users/user/code/cli-app/env/lib/python3.7/site-packages/prompt_toolkit/key_binding/key_bindings.py", line 188, in <genexpr>
keys = tuple(_check_and_expand_key(k) for k in keys)
File "/Users/user/code/cli-app/env/lib/python3.7/site-packages/prompt_toolkit/key_binding/key_bindings.py", line 337, in _check_and_expand_key
raise ValueError('Invalid key: %s' % (key, ))
ValueError: Invalid key: c-Y
It looks like those key combos would need to be added to python-prompt-toolkit/prompt_toolkit/keys.py.
I'm not sure if this is a bug, or if I'm just misunderstanding how this works (I've just started learning prompt-toolkit).
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
Start by reading the special-key documentation and inspecting python-prompt-toolkit/prompt_toolkit/keys.py, then trace how key_bindings.py validates the c-Y key name. Confirm the intended uppercase control-key syntax and add the necessary handling so the documented binding is accepted, with coverage for the reported case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100