python / python/cpython

PyREPL: ESC key in isearch mode has ambiguous prefix delay

Aperta
#154,730 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

stdlib topic-repl type-bug
Lingua principale
Python
Stelle
77.2k
Fork
36k
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

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
  • gh-154731

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
cli
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.