You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
Bug report
Bug description:
This issue was noted from #145398. A bare
Escpress in isearch mode (Ctrl-R) does not exit search. Instead, the firstEscappears to do nothing, only after pressingEsca second time does isearch end.To reproduce:
Ctrl-Rin PyREPL to enter isearch.Esconce to exit isearch.Escagain, isearch ends.This is because
BaseEventQueue.push()treats\x1b(ESC) as a prefix of longer escape sequences (arrows, function keys, etc.). When a singleEscis received, the event queue holds it and waits for the next byte to decide whether it’s a standaloneEscor the start of a longer sequence. If no further byte arrives, theEscevent is never delivered, and isearch remains active.Apart from isearch mode, this behavior affects normal mode as well, where
Escalso has a delay before it is recognized.CPython versions tested on:
CPython main branch
Operating systems tested on:
Windows
Linked PRs
Escand multibyte escape sequence #154731