mirror of
https://github.com/openai/codex.git
synced 2026-11-15 21:50:46 +00:00
Unify TUI status content and layout caching in StatusLine (#61200)
## What changed - Replace `FooterContent` and the separate layout cache with a `StatusLine` that owns native or extension content and caches its layout by bounds. - Move footer padding into the caller's layout and retain cached wrapping for unchanged agent-labeled status lines. - Remove extension-to-single-line conversion and render prepared UI trees directly within their allotted rectangles. ## Testing Extend composer coverage to verify that replacing measured extension content updates the displayed rows. Adapt status-line and UI-tree tests to exercise direct rendering, clipping, hyperlinks, and viewport bounds. GitOrigin-RevId: 72273c87d689b8b59748ab243793a9e2a45f4884
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
//! history-facing `/status` surface.
|
||||
|
||||
use super::*;
|
||||
use crate::bottom_pane::footer_content::FooterContent;
|
||||
use crate::bottom_pane::StatusLine;
|
||||
use crate::status::thread_cost_micros;
|
||||
|
||||
impl ChatWidget {
|
||||
@@ -84,7 +84,7 @@ impl ChatWidget {
|
||||
}
|
||||
|
||||
/// Sets the currently rendered footer status-line value.
|
||||
pub(crate) fn set_status_line(&mut self, status_line: Option<FooterContent>) {
|
||||
pub(crate) fn set_status_line(&mut self, status_line: Option<StatusLine>) {
|
||||
self.bottom_pane.set_status_line(status_line);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,14 +3,6 @@ use crate::bottom_pane::preview_line_for_title_items;
|
||||
use crate::chatwidget::ThreadUsageOutcome;
|
||||
use codex_app_server_protocol::ThreadUsage;
|
||||
use pretty_assertions::assert_eq;
|
||||
use ratatui::text::Line;
|
||||
|
||||
fn line_text(line: Line<'static>) -> String {
|
||||
line.spans
|
||||
.into_iter()
|
||||
.map(|span| span.content.into_owned())
|
||||
.collect()
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn thread_color_preview_matches_footer() {
|
||||
@@ -31,7 +23,6 @@ async fn thread_color_preview_matches_footer() {
|
||||
let line = preview
|
||||
.status_line_for_items(items, use_colors)
|
||||
.unwrap()
|
||||
.into_hyperlink_line()
|
||||
.line;
|
||||
let footer = crate::bottom_pane::status_line_from_segments(
|
||||
items
|
||||
@@ -54,7 +45,7 @@ fn status_preview_line_option(chat: &mut ChatWidget, items: &[StatusLineItem]) -
|
||||
let preview_data = chat.status_surface_preview_data();
|
||||
preview_data
|
||||
.status_line_for_items(items.iter().copied(), /*use_theme_colors*/ true)
|
||||
.map(|content| line_text(content.into_hyperlink_line().line))
|
||||
.map(|line| line.line.to_string())
|
||||
}
|
||||
|
||||
fn status_preview_line(chat: &mut ChatWidget, items: &[StatusLineItem]) -> String {
|
||||
@@ -65,7 +56,7 @@ fn title_preview_line(chat: &mut ChatWidget, items: &[TerminalTitleItem]) -> Str
|
||||
let preview_data = chat.terminal_title_preview_data();
|
||||
let preview =
|
||||
preview_line_for_title_items(items, &preview_data).expect("terminal title preview line");
|
||||
line_text(preview)
|
||||
preview.to_string()
|
||||
}
|
||||
|
||||
fn combined_preview_snapshot(
|
||||
|
||||
Reference in New Issue
Block a user