Skip to main content

draw_input

Function draw_input 

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

Render the input composer row into area and position the terminal cursor at the true edit position.

Why: a borderless single row (Claude Code style) — the <label>> prompt is sufficient demarcation without spending a row on a border. What: empty input shows a dim italic placeholder (busy vs. idle hint); non-empty input renders the buffer with each queued newline shown as [NEWLINE_GLYPH] (#8240) and everything else verbatim; either way, a busy state additionally right-aligns [thinking...] — or [cancelling...] while a dispatched cancel is unconfirmed (#8207) — if the row is wide enough. The cursor is positioned by counting chars up to app.cursor_pos, not bytes, so multi-byte input doesn’t desync the visual cursor from the true edit point — the glyph is one char for one \n, so that count is unaffected by the substitution. Test: tests::draw_input_shows_idle_placeholder_when_empty, tests::draw_input_shows_queued_newlines_as_a_glyph and friends exercise the pure text composition via [compose_line]; the Frame/cursor-position side effects are integration-level and covered by crate::layout::draw’s manual/visual verification.