mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Clamp session headers to narrow terminal widths (#34775)
## Why Session header rows can exceed the available inner width when the terminal is narrow, causing the bordered header to render wider than its requested width. ## What changed Truncate each session header row to the available inner width and append an ellipsis when content overflows. ## Testing Add a snapshot test for a 44-column session header and assert that every rendered line matches the requested width. GitOrigin-RevId: 7cf0ea48aa95a6f1ddd1a9dbb7c7fb70bdbcb5a3
This commit is contained in:
1 parent
c00e2e851c
commit
730ec92003
3 files changed
+36
No files matched your search
@@ -1,6 +1,7 @@
|
||||
//! Session headers, onboarding guidance, and transcript cards.
|
||||
|
||||
use super::*;
|
||||
use crate::line_truncation::truncate_line_with_ellipsis_if_overflow;
|
||||
|
||||
pub(crate) const SESSION_HEADER_MAX_INNER_WIDTH: usize = 56; // Just an eyeballed value
|
||||
|
||||
@@ -390,6 +391,10 @@ impl HistoryCell for SessionHeaderHistoryCell {
|
||||
]));
|
||||
}
|
||||
|
||||
let lines = lines
|
||||
.into_iter()
|
||||
.map(|line| truncate_line_with_ellipsis_if_overflow(line, inner_width))
|
||||
.collect();
|
||||
with_border(lines)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user