Skip to content

gh-127073: Clear completion list when KeyboardInterrupt occurs #128442

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

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Lib/_pyrepl/simple_interact.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ def maybe_run_command(statement: str) -> bool:
r = _get_reader()
if r.input_trans is r.isearch_trans:
r.do_cmd(("isearch-end", [""]))
if r.cmpltn_menu_choices:
r.cmpltn_reset()
r.pos = len(r.get_unicode())
r.dirty = True
r.refresh()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Previously in the REPL, when a completion list was displayed and KeyboardInterrupt
was triggered using Ctrl+C, the completion list would persist and duplicate with
each KeyboardInterrupt. Now, when KeyboardInterrupt occurs, the completion list
is properly cleared, consistent with the behavior of other errors.
Loading