Table of Contents

Class TerminalInput

Namespace
RatatuiUnity

Single-line text input field with cursor navigation, editing, and horizontal scrolling. Pure C# state — renders via StyledParagraph.

public class TerminalInput
Inheritance
TerminalInput
Inherited Members

Constructors

TerminalInput(string)

Create an input with optional initial value.

public TerminalInput(string initialValue = "")

Parameters

initialValue string

Properties

Cursor

Cursor position as a character index [0..Value.Length].

public int Cursor { get; set; }

Property Value

int

ScrollOffset

Index of the first visible character (auto-managed during Render).

public int ScrollOffset { get; }

Property Value

int

Value

Current text content. Setting this clamps the cursor.

public string Value { get; set; }

Property Value

string

Methods

DeleteBack()

Delete character before cursor (Backspace).

public void DeleteBack()

DeleteForward()

Delete character at cursor (Delete key).

public void DeleteForward()

DeleteWordBack()

Delete word before cursor (Ctrl+Backspace).

public void DeleteWordBack()

DeleteWordForward()

Delete word at cursor (Ctrl+Delete).

public void DeleteWordForward()

HandleKeyEvent(TerminalKeyEvent)

Process a keyboard event. Call from OnTerminalKeyDown. Returns true if the event was consumed.

public bool HandleKeyEvent(TerminalKeyEvent e)

Parameters

e TerminalKeyEvent

Returns

bool

HandleMouseEvent(TerminalMouseEvent)

Process a mouse click to position the cursor. Call from OnTerminalMouseEvent for Click events on the input area. Uses the area geometry stored from the last Render(RatatuiTerminal, uint, Color, Color, Color, Color) call. Returns true if cursor position changed.

public bool HandleMouseEvent(TerminalMouseEvent e)

Parameters

e TerminalMouseEvent

Returns

bool

InsertChar(char)

public void InsertChar(char c)

Parameters

c char

MoveLeft()

public void MoveLeft()

MoveRight()

public void MoveRight()

MoveToEnd()

public void MoveToEnd()

MoveToStart()

public void MoveToStart()

MoveWordLeft()

public void MoveWordLeft()

MoveWordRight()

public void MoveWordRight()

Render(RatatuiTerminal, uint, Color, Color, Color, Color)

Render the input field into the given area. Shows cursor as inverted-color cell. Handles horizontal scrolling automatically.

public void Render(RatatuiTerminal term, uint areaId, Color fg = default, Color bg = default, Color cursorFg = default, Color cursorBg = default)

Parameters

term RatatuiTerminal
areaId uint
fg Color

Text foreground color (Color.clear = terminal default white).

bg Color

Text background color (Color.clear = terminal default).

cursorFg Color

Cursor foreground (Color.clear = black).

cursorBg Color

Cursor background (Color.clear = white).