Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

PyREPL: ESC key in isearch mode has ambiguous prefix delay #154730

Copy link
Copy link

Description

@tanloong
Issue body actions

Bug report

Bug description:

This issue was noted from #145398. A bare Esc press in isearch mode (Ctrl-R) does not exit search. Instead, the first Esc appears to do nothing, only after pressing Esc a second time does isearch end.

To reproduce:

  1. Press Ctrl-R in PyREPL to enter isearch.
  2. Press Esc once to exit isearch.
  • Expected: isearch ends immediately.
  • Actual: nothing happens. Press Esc again, isearch ends.

This is because BaseEventQueue.push() treats \x1b (ESC) as a prefix of longer escape sequences (arrows, function keys, etc.). When a single Esc is received, the event queue holds it and waits for the next byte to decide whether it’s a standalone Esc or the start of a longer sequence. If no further byte arrives, the Esc event is never delivered, and isearch remains active.

Apart from isearch mode, this behavior affects normal mode as well, where Esc also has a delay before it is recognized.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Windows

Linked PRs

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.