fix(tui/agents): guard overlay clamp (fixes #478)

This commit is contained in:
James Peter
2025-12-28 09:55:09 +10:00
parent d7337052f9
commit 7b28c36be3
2 changed files with 12 additions and 1 deletions
+2 -1
View File
@@ -35866,7 +35866,8 @@ impl ChatWidget<'_> {
body_area.width
} else {
let max_allowed = body_area.width.saturating_sub(30).max(18);
desired_sidebar.clamp(24, max_allowed)
let min_allowed = 24.min(max_allowed);
desired_sidebar.clamp(min_allowed, max_allowed)
};
let constraints = if body_area.width <= sidebar_width {
@@ -2324,6 +2324,16 @@ fn agent_status_missing_batch_displays_error() {
insta::assert_snapshot!("agent_status_missing_batch_displays_error", output);
}
#[test]
fn agents_overlay_narrow_terminal_does_not_panic() {
let mut harness = ChatWidgetHarness::new();
harness.send_key(make_key(KeyCode::Char('a'), KeyModifiers::CONTROL));
let output = render_chat_widget_to_vt100(&mut harness, 52, 18);
let output = normalize_output(output);
assert!(output.contains("Agents"), "Agents overlay did not render");
}
#[test]
fn agents_toggle_claude_opus_persists_via_slash_command() {
let _lock = ENV_LOCK.lock().unwrap();