feat(list): list TUI のメニューを Esc 単独でも中止可能に (i31)#44
Merged
Conversation
questionary 2.x の select は Ctrl-C / Ctrl-Q しか中止に割り当てないため、 生成済み Question.application.key_bindings に Escape ハンドラを後付けする _with_escape_cancel() を追加し、プロジェクト選択 (_show_menu) と running 操作選択 (_show_action_menu) の両メニューに適用する。 - Esc は矢印キー等のエスケープシーケンス先頭でもあるため eager=False で登録し、 prompt_toolkit のフラッシュ待ちで単独 Esc のみを拾う (矢印キーと非衝突) - Ctrl-C と同じく KeyboardInterrupt で抜けるので ask() は None (中止) を返す - プロンプト案内を「Ctrl-C 中止」→「Esc・Ctrl-C 中止」に更新 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
devbase listの対話メニュー (questionary) を Esc 単独押下でも中止できるようにする。従来は中止操作が Ctrl-C / Ctrl-Q のみで、Esc では何も起きなかった。
questionary 2.x の
selectは Ctrl-C / Ctrl-Q しか中止キーに割り当てていないため、生成済み
Question.application.key_bindingsに Escape ハンドラを後付けするヘルパー
_with_escape_cancel()を追加し、プロジェクト選択メニュー (_show_menu) とrunning 操作選択メニュー (
_show_action_menu) の両方に適用した。関連 Issue
変更点
_with_escape_cancel()を追加し、_show_menu/_show_action_menuの両 select に Esc 中止を後付け\x1b[A等) の先頭バイトでもあるためeager=Falseで登録し、prompt_toolkit のフラッシュ待ちで単独 Esc のみを拾う (矢印キー移動と非衝突)KeyboardInterruptで抜けるためask()は従来どおりNone(=中止) を返し、呼び出し側の中止フローはそのまま機能する動作確認
uv run pytest全 462 passed / 1 skipped (既存スキップ)_show_menu/_show_action_menuが実際に Esc 中止を仕込むことを配線テストで検証補足