Skip to content

render() function

Home > streplts > render

Draws the active terminal state line and overlay menus onto the output stream.

Signature:

export declare function render(state: ReplState, registry: Registry, promptStr: string, jsMode: boolean, opts: RenderOptions | undefined, stdout: Writable & {
columns?: number;
rows?: number;
}, context: any, globals: any): void;

Parameter

Type

Description

state

ReplState

Current REPL state (input, cursor position, candidates, etc.).

registry

Registry

Registry of command metadata used for completion and colouring.

promptStr

string

The prompt string to display (may contain ANSI codes).

jsMode

boolean

Whether the JS VM input mode is active.

opts

RenderOptions | undefined

Optional rendering overrides (e.g. flash the prompt red on error).

stdout

Writable & { columns?: number; rows?: number; }

The writable stream to render into.

context

any

Sandbox context reference passed through to colorInput.

globals

any

Global variables reference passed through to colorInput.

Returns:

void

Calculates previous drop lists, prints ghost hints, adds syntax text-coloring tokens, renders scrolling window overlays for overflows, and highlights selection blocks.