Skip to main content

Module input

Module input 

Source
Expand description

Multi-mode PromptInput renderer (Goal 145).

The input area is split into two stacked rectangles: the input frame (with a one-character mode indicator on the left) and a single-line footer hint (mode-dependent text on the second row).

Real cursor positioning is computed from the prompt buffer’s byte offset and pushed onto the frame via Frame::set_cursor_position. We deliberately don’t draw a synthetic glyph () so the terminal’s native cursor remains the single source of truth.

Sizing: the input pane height is min(buffer line count + 1, 6) plus a one-row footer below.

Constants§

MAX_VISIBLE_ROWS
Maximum visible input rows (after which the box scrolls internally). The +2 below accounts for the box’s borders.

Functions§

cursor_visual_position
Convert a buffer + byte cursor offset into a (col, row) inside the edit area (zero-based, where col counts columns from the first editable cell, not including the box border).
footer_hint
Single-line hint shown below the input frame.
render
Render the input frame + footer hint into area. Sets the terminal cursor to the active edit position.
total_height
Total height the chat layout should reserve for the input + footer stack, given the current buffer.