Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

tui: avoid panic when active exec cell area is zero height (#3133)

Jeremy Rose1e82bf9d98f6
diff --git a/codex-rs/tui/src/chatwidget.rs b/codex-rs/tui/src/chatwidget.rs
index 7514921136..e8381c6f4d 100644
--- a/codex-rs/tui/src/chatwidget.rs
+++ b/codex-rs/tui/src/chatwidget.rs
@@ -1371,9 +1371,11 @@ impl WidgetRef for &ChatWidget {
fn render_ref(&self, area: Rect, buf: &mut Buffer) {
let [active_cell_area, bottom_pane_area] = self.layout_areas(area);
(&self.bottom_pane).render(bottom_pane_area, buf);
- if let Some(cell) = &self.active_exec_cell {
+ if !active_cell_area.is_empty()
+ && let Some(cell) = &self.active_exec_cell
+ {
let mut active_cell_area = active_cell_area;
- active_cell_area.y += 1;
+ active_cell_area.y = active_cell_area.y.saturating_add(1);
active_cell_area.height -= 1;
cell.render_ref(active_cell_area, buf);
}