Files
codex/codex-rs/tui/src/app/agents_overview_loading.rs
T
Eric Traut 0666c12e78 Show a loading message when opening tasks from the agents overview (#45983)
## Why

Task attachment awaits server requests while the event handler cannot process scheduled frames. Prompts and chat widget replacement can also clear the terminal during loading.

## What changed

Draw a bold `Loading task…` message immediately when attaching a task, and redraw it after folder selection, trust prompts, and chat widget replacement. Schedule a frame to restore the normal view afterward.

## Testing

Extend the cold-resume test to verify that a loading message appears before server requests complete, survives widget replacement, and is replaced on the next draw.

GitOrigin-RevId: cb2e73efe38758025964aa53f52127a2b2609fca
2026-09-16 16:56:18 +00:00

20 lines
733 B
Rust

//! Transient feedback while command-center selection waits for a session to load.
//! Draw directly because the app event handler cannot process scheduled frames while awaiting.
use crate::tui::Tui;
use ratatui::style::Stylize;
use ratatui::text::Line;
use ratatui::widgets::Paragraph;
pub(super) fn draw(tui: &mut Tui) -> std::io::Result<()> {
tui.draw(u16::MAX, |frame| {
let lines = textwrap::wrap("Loading task…", usize::from(frame.area().width.max(1)))
.into_iter()
.map(|line| Line::from(line.into_owned().bold()))
.collect::<Vec<_>>();
frame.render_widget_ref(&Paragraph::new(lines), frame.area());
})?;
tui.frame_requester().schedule_frame();
Ok(())
}