python / python/cpython

PyREPL: ESC key in isearch mode has ambiguous prefix delay

オープン
#154,730 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

stdlib topic-repl type-bug
主要言語
Python
スター
77.2k
フォーク
35.9k
PR マージ指標
PR 指標を取得中

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
cli
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。