Respect rendered width when adding TUI history (#38075)

## What changed

- Initialize new chat widgets with the current terminal width.
- Determine whether an added history cell is visible using the active history
  render mode and the width available after ambient-pet reservations.
- Saturate diff-summary width calculations so extremely narrow terminals remain
  renderable.

## Testing

- Cover width-sensitive history insertion with an ambient pet, raw-output mode,
  and a diff summary narrower than its indentation.

GitOrigin-RevId: 82d20900e0637431be7646b4f4aba61810ff74c1
This commit is contained in:
Tamir Duberstein authored and copyberry committed 2026-08-11 21:12:23 +00:00
1 parent a817d9424d
commit 33aaf91366
7 files changed
+84 -12

No files matched your search

@@ -533,6 +533,8 @@ impl App {
/*initial_user_message*/ None,
);
self.replace_chat_widget(ChatWidget::new_with_app_event(init));
self.chat_widget
.note_rendered_width(tui.terminal.last_known_screen_size.width);
if blocks_direct_input {
self.chat_widget.set_parent_owned_thread();
}
@@ -754,6 +756,8 @@ impl App {
initial_user_message,
);
self.replace_chat_widget(ChatWidget::new_with_app_event(init));
self.chat_widget
.note_rendered_width(tui.terminal.last_known_screen_size.width);
if started.blocks_direct_input {
self.mark_primary_thread_parent_owned(started.session.thread_id);
}