Skip to main content

draw

Function draw 

Source
pub fn draw(f: &mut Frame<'_>, app: &ReplApp)
Expand description

Top-level draw: banner (in-scrollback) + chat (sized to content) + separator + input + separator + statusline + trailing spacer.

Why: sizing the chat pane to its actual content height (rather than Constraint::Min, which expands to fill the screen) lets the input row float up directly beneath the last message instead of always being pinned to the bottom of the terminal — matches tagent’s layout.rs rationale (issue #337 upstream). What: reserves fixed 1-row constraints for both separators, the input row, and the statusline, then gives the chat pane min(content_height, available_height). A trailing Constraint::Min(1) spacer absorbs leftover space so nothing gets stretched to fill the terminal. Test: pure geometry is covered by crate::widgets::scrollback::chat_line_count’s own tests; the full Frame composition is exercised via ratatui::backend::TestBackend in tests::draw_renders_without_panicking, which is a smoke test (no TTY, no assertions on cell contents — see that test’s doc comment).