prompt-toolkit / prompt-toolkit/python-prompt-toolkit
Terminal left in broken state after exit when binding ctrl-c
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.6k
- Forks
- 815
- PR merge metrics
- No merged PRs in 30d
Description
import sys
import prompt_toolkit
from prompt_toolkit.key_binding import KeyBindings
def main():
bindings = KeyBindings()
@bindings.add("c-c")
def _(event):
sys.exit()
session = prompt_toolkit.PromptSession(key_bindings=bindings)
while True:
line = session.prompt("> ")
if __name__ == '__main__':
main()
After pressing ctrl-c, the terminal is no longer processing ctr-c (a literal ^C is inserted).
Version: 3.0.36
Terminals tested: Tilix, gnome-terminal
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 running the provided Python reproducer with prompt_toolkit 3.0.36 and inspect PromptSession and the c-c key binding path. Confirm that exiting leaves the terminal unable to process Ctrl-C and that a literal ^C is inserted; done means the terminal handles Ctrl-C normally after exit.
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
- Clearly specified
- Newbie friendliness
- 35/100