[BUG] Panel.fit cuts off the subtitle when it is wider than the content
まだ誰も着手していません。
評価
調査の方向性
rich/panel.pyから始めます。issueでは、__rich_measure__と__rich_console__がタイトルを処理する一方で、サブタイトルを処理しないと指摘されています。サブタイトルの処理を既存のタイトル処理と比較し、該当するpanelのテストを実行してください。Panel.fitが長いサブタイトルを切り詰めずに含め、期待される出力と一致すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
- I've checked docs and closed issues for possible solutions.
- I can't find my issue in the FAQ.
Describe the bug
Panel.fit widens the panel for a long title, but not for a long subtitle, so the subtitle is truncated:
from rich.console import Console
from rich.panel import Panel
Console(width=80).print(Panel.fit("Hello", title="App", subtitle="press q to quit"))
╭─ App ─╮
│ Hello │
╰─ pres─╯
With Panel.fit("x", subtitle="a long subtitle here") the bottom border is just ╰─ ─╯ and the subtitle is gone.
Expected ╰─ press q to quit ─╯, the same way a long title is handled.
In rich/panel.py, __rich_measure__ measures _title but not _subtitle, and __rich_console__ widens the panel for title_text only.
Platform
Click to expand
Linux. Reproduced with rich 14.1.0 and master (3a109ccd), output to a plain Console(width=80).
- 主要言語
- Python
- スター
- 57.8k
- フォーク
- 2.6k
- 平均マージ
- 20分
- マージ済み PR(30日)
- 3
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Textualize/rich のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
Textualize/rich#4269 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Textualize/rich#4268 ·
-
Needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Textualize/rich#4267 ·
-
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
Textualize/rich#4266 ·
-
[BUG] `Text.right_crop(0)` empties the text and an amount larger than the text makes `len()` raiseオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
Textualize/rich#4265 ·
Textualize/rich の issue をすべて見る
似ている issue
-
Internal Errorオープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
frappe/frappe_docker#2071 ·
メンテナーはふだん 1 日以内に返信
-
bug python
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
traceloop/openllmetry#4717 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
The-Pocket/PocketFlow#161 ·
-
comp/desktop P2 type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
NousResearch/hermes-agent#157702 ·
メンテナーはふだん 1 日以内に返信
-
scibench_physics / scibench_chemistry: a correct answer scores 0 when the unit has a power of ten対応中かも @BahaaMattar が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
EvolvingLMMs-Lab/lmms-eval#1699 ·
メンテナーはふだん 1 日以内に返信