fix(tui/history): append merge completion banner

This commit is contained in:
James Peter
2025-09-17 03:27:14 +10:00
parent 3e9b516acc
commit 736293a90a
5 changed files with 31 additions and 2 deletions
+7
View File
@@ -429,6 +429,13 @@ impl App<'_> {
}
AppState::Onboarding { .. } => {}
},
AppEvent::InsertBackgroundEventLate(message) => match &mut self.app_state {
AppState::Chat { widget } => {
tracing::debug!("app: InsertBackgroundEventLate len={}", message.len());
widget.insert_background_event_late(message);
}
AppState::Onboarding { .. } => {}
},
AppEvent::RequestRedraw => {
self.schedule_redraw();
}
+3
View File
@@ -145,6 +145,9 @@ pub(crate) enum AppEvent {
/// Insert a background event near the top of the current request so it
/// appears above imminent provider output (e.g. above Exec begin).
InsertBackgroundEventEarly(String),
/// Insert a background event at the end of the current request so it
/// follows previously rendered content.
InsertBackgroundEventLate(String),
#[allow(dead_code)]
StartCommitAnimation,
+6
View File
@@ -60,4 +60,10 @@ impl AppEventSender {
self.send(AppEvent::InsertBackgroundEventEarly(message.into()));
}
/// Emit a background event appended to the current request window so it
/// shows up after previously rendered content.
pub(crate) fn send_background_event_late(&self, message: impl Into<String>) {
self.send(AppEvent::InsertBackgroundEventLate(message.into()));
}
}
+14 -1
View File
@@ -2644,6 +2644,15 @@ impl ChatWidget<'_> {
None,
);
}
/// Insert a background event at the tail of the current request.
pub(crate) fn insert_background_event_late(&mut self, message: String) {
self.push_system_cell(
history_cell::new_background_event(message),
SystemPlacement::EndOfCurrent,
None,
None,
);
}
/// Push a cell using a synthetic key at the TOP of the NEXT request.
fn history_push_top_next_req(&mut self, cell: impl HistoryCell + 'static) {
let key = self.next_req_key_top();
@@ -9336,6 +9345,10 @@ impl ChatWidget<'_> {
tx.send_background_event(message);
}
fn send_background_late(tx: &AppEventSender, message: String) {
tx.send_background_event_late(message);
}
let git_root = match codex_core::git_info::resolve_root_git_project_for_trust(&work_cwd)
{
Some(p) => p,
@@ -9885,7 +9898,7 @@ impl ChatWidget<'_> {
default_branch,
git_root.display()
);
send_background(&tx, msg);
send_background_late(&tx, msg);
tx.send(AppEvent::SwitchCwd(git_root, None));
});
}
+1 -1
View File
@@ -7706,7 +7706,7 @@ pub(crate) fn new_plan_update(update: UpdatePlanArgs) -> PlanUpdateCell {
Span::styled(
step,
Style::default()
.fg(crate::colors::success())
.fg(crate::colors::text_bright())
.add_modifier(Modifier::BOLD),
),
),