feat(tui): devbase list 実行時に画面をクリアしてプロンプトを先頭行に表示#72
Merged
Conversation
トップ一覧の再描画前に `_clear_screen()` を呼び、表示領域とスクロール バックを消去してカーソルを先頭行へ戻す (CTRL+L 相当)。非 TTY 時は何も しない。 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.
Pull Request
概要
devbase list(= 階層メニュー TUI) を起動・再描画する際に、端末画面をクリア (CTRL+L 相当) してメニュープロンプトを画面の先頭行から表示するようにした。従来は前のコマンド出力が画面に残ったまま一覧が下方に描画され、視認性が悪かった。関連 Issue
変更点
lib/devbase/tui/app.pyに_clear_screen()を追加。\033[3J\033[2J\033[Hを出力して表示領域・スクロールバックを消去し、カーソルを左上へ移動する。stdout が非 TTY の場合は何もしない (リダイレクト時の制御文字混入を防止)。_top_menu_loop()のループ先頭で_clear_screen()を呼び、トップ一覧の再描画前に必ず画面をクリアする。動作確認
./bin/devbase --helpが正常に動作するdevbase list実行時に画面がクリアされ、プロンプトが先頭行に表示されるast.parse) が通るスクリーンショット・ログ(任意)
補足
非 TTY (パイプ・リダイレクト) では制御シーケンスを出力しないため、既存のスクリプト用途に影響しない。