Skip to main content

draw_chat

Function draw_chat 

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

Render the chat pane into area, bottom-pinned when content fits.

Why: mirrors an iMessage/Slack-style chat feel — short conversations sit flush at the bottom of the pane rather than floating at the top with a sea of blank space below. What: pads with blank lines above the content when it fits; otherwise scrolls so the newest line stays in view (clamped by app.scroll_offset). Publishes the computed max scroll offset to app.last_max_scroll so ReplApp::scroll can clamp future deltas. Every one of those numbers counts WRAPPED rows ([rendered_row_count]), matching what the Paragraph renders and what its scroll advances by (#8205). Test: exercised via draw in crate::layout, including crate::layout::tests::draw_keeps_the_connect_line_home_segment_at_80_columns; the pure geometry (padding decision, max-offset computation) is covered indirectly through build_chat_lines’s tests plus ReplApp::scroll’s own tests in crate::app::reduce.