PyREPL: ESC key in isearch mode has ambiguous prefix delay
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 77.2k
- Forks
- 36k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
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:
- Press
Ctrl-Rin PyREPL to enter isearch. - Press
Esconce to exit isearch.
- Expected: isearch ends immediately.
- Actual: nothing happens. Press
Escagain, 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
- gh-154731
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Start with BaseEventQueue.push() and the escape-sequence definitions in Lib/_pyrepl/unix_eventqueue.py and Lib/_pyrepl/windows_eventqueue.py. Review linked PR gh-154731 and the existing PyREPL event handling before making changes. Done means a bare Esc exits isearch immediately and is recognized without the current delay in normal mode.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- cli
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 25/100