Preserve status-line hyperlinks through footer layout and animations (#57883)

## Why

Footer hyperlinks must follow their text when the status line is truncated or animated. Inferring link targets from underlined cells loses that association, and Unicode width differences can shift links onto the wrong cells.

## What changed

- Carry explicit hyperlink ranges with status-line content through footer layout and reasoning-effort transitions.
- Fit content to the space allocated beside right-hand indicators, keeping the truncation ellipsis outside links.
- Measure and truncate rendered graphemes consistently while preserving source columns for transcript tab expansion.
- Box the composer's footer state to reduce its stack footprint during session navigation.

## Testing

Add regression tests for clipped links after halfwidth katakana and Arabic prefixes, hyperlink positions during effort transitions, and narrow status rows beside the Plan mode indicator.

GitOrigin-RevId: ede62690e191daefc85f38e637f9bcc9796268b7
This commit is contained in:
Joe Savona
2026-10-29 02:10:32 +00:00
committed by copyberry
parent e75e4af229
commit 6c776cfc8c
26 changed files with 534 additions and 321 deletions
@@ -83,13 +83,9 @@ impl ChatWidget {
}
/// Sets the currently rendered footer status-line value.
pub(crate) fn set_status_line(&mut self, status_line: Option<Line<'static>>) {
self.bottom_pane.set_status_line(status_line);
}
/// Sets the terminal hyperlink target for the currently rendered footer status line.
pub(crate) fn set_status_line_hyperlink(&mut self, url: Option<String>) {
self.bottom_pane.set_status_line_hyperlink(url);
pub(crate) fn set_status_line(&mut self, status_line: Option<HyperlinkLine>) {
self.bottom_pane
.set_status_line(status_line.map(Into::into));
}
/// Forwards the contextual active-agent label into the bottom-pane footer pipeline.
@@ -206,7 +206,6 @@ impl ChatWidget {
self.bottom_pane.set_status_line_enabled(enabled);
if !enabled {
self.set_status_line(/*status_line*/ None);
self.set_status_line_hyperlink(/*url*/ None);
return;
}
@@ -221,13 +220,8 @@ impl ChatWidget {
segments,
self.local_settings.tui.status_line_use_colors,
self.thread_id,
self.status_line_pull_request_url(),
));
let hyperlink_url = selections
.status_line_items
.contains(&StatusLineItem::PullRequestNumber)
.then(|| self.status_line_pull_request_url())
.flatten();
self.set_status_line_hyperlink(hyperlink_url);
}
/// Clears the terminal title Codex most recently wrote, if any.
@@ -852,11 +846,11 @@ impl ChatWidget {
}
}
fn status_line_pull_request_url(&self) -> Option<String> {
fn status_line_pull_request_url(&self) -> Option<&str> {
self.status_line_git_summary
.as_ref()
.and_then(|summary| summary.pull_request.as_ref())
.map(|pull_request| pull_request.url.clone())
.map(|pull_request| pull_request.url.as_str())
}
pub(super) fn status_surface_preview_value_for_item(
@@ -35,9 +35,10 @@ async fn thread_color_preview_matches_footer() {
.map(|item| (item, chat.status_line_value_for_item(item).unwrap())),
use_colors,
Some(id),
/*pull_request_url*/ None,
)
.unwrap();
assert_eq!(line, footer);
assert_eq!(line, footer.line);
snapshot.push(format!("colors={use_colors}: {line:?}"));
}
insta::assert_snapshot!(snapshot.join("\n"));