Layout
Category: Terminal & Rendering
Source: layout.dart
Classes
Layout
Divides the terminal into vertical zones that cooperate using ANSI scroll regions.
┌──────────────────────────────┐
│ Output Zone (scrollable) │ ← uses terminal's native scroll
│ ... │
├──────────────────────────────┤
│ Overlay Zone (0-N lines) │ ← autocomplete popup, etc.
├──────────────────────────────┤
│ Status Bar (1 line, fixed) │ ← painted at fixed row
├──────────────────────────────┤
│ Input Zone (1-N lines) │ ← painted at bottom
└──────────────────────────────┘The scroll region trick keeps output scrolling naturally while the overlay, status bar, and input area stay pinned.
Constructor
Layout(this.terminal)Properties
| Property | Type | Description |
|---|---|---|
terminal | Terminal | |
outputTop | int get | First row of the scrollable output zone. |
outputBottom | int get | Last row of the scrollable output zone. |
outputLeft | int get | Left column of the scrollable output zone. |
outputRight | int get | Right column of the scrollable output zone. |
outputWidth | int get | Width of the output zone. |
outputHeight | int get | Height of the output zone. |
overlayTop | int get | First row of the overlay zone (between output and status bar). |
overlayBottom | int get | Last row of the overlay zone. |
statusRow | int get | Row where the status bar is painted. |
inputTop | int get | First row of the input area. |
inputBottom | int get | Last row of the input area. |
outputTop | int get | First row of the scrollable output zone. |
outputBottom | int get | Last row of the scrollable output zone. |
outputLeft | int get | Left column of the scrollable output zone. |
outputRight | int get | Right column of the scrollable output zone. |
outputWidth | int get | Width of the output zone. |
outputHeight | int get | Height of the output zone. |
overlayTop | int get | First row of the overlay zone (between output and status bar). |
overlayBottom | int get | Last row of the overlay zone. |
statusRow | int get | Row where the status bar is painted. |
inputTop | int get | First row of the input area. |
inputBottom | int get | Last row of the input area. |
Methods
void apply()
Apply (or re-apply) the hardware scroll region so that text printed inside the output zone scrolls without disturbing the status bar or input area.
void setInputHeight(int lines)
Update the input zone height (e.g. for multi-line editing).
`void applyDockGutters({
int left = 0,
int top = 0,
int right = 0,
int bottom = 0,
})`
Update dock gutters for pinned panels.
void setOverlayHeight(int lines)
Update the overlay zone height. Call before rendering.
Only calls [apply] if the height actually changed to avoid flicker.
void paintOutputViewport(List<String> lines)
Paint the output zone with pre-computed lines for scrollback.
void writeOutput(String text)
Append [text] to the output zone (scrolls naturally within the scroll region).
void paintOverlay(List<String> lines)
Paint the overlay zone with pre-rendered lines.
`void paintRect({
required int row,
required int col,
required int width,
required int height,
required List<String> lines,
})`
Paint a rectangular block without disturbing other cells.
void paintStatus(String left, String right)
Paint the status bar at its fixed row.
[left] is shown left-aligned and [right] is shown right-aligned.
`void paintInput(
String prompt,
List<String> lines,
int cursorRow,
int cursorCol, {
bool showCursor = true,
AnsiStyle promptStyle = AnsiStyle.yellow,
})`
Paint the multiline input area.
[prompt] is shown on the first line (e.g. '❯ '), continuation lines are indented with a dimmed '· ' indicator to the same width. [lines] are the logical lines of text, [cursorRow] and [cursorCol] are the cursor position within the logical lines.
Handles visual line wrapping and scrolls the viewport when content exceeds [AppConstants.maxInputVisibleLines].