Table of Contents

Class TerminalInput

Namespace
RatatuiUnity

Single-line text input with selection, clipboard, undo/redo, unicode + CJK width-aware cursor, placeholder, password mask, max length, character filter, cursor blink, click-and-drag selection, double/triple-click, and optional select-all on focus. Pure C# state; renders via StyledParagraph.

public class TerminalInput
Inheritance
TerminalInput
Inherited Members

Constructors

TerminalInput(string)

public TerminalInput(string initialValue = "")

Parameters

initialValue string

Properties

AutoCorrection

Enable native autocorrection on the virtual keyboard.

public bool AutoCorrection { get; set; }

Property Value

bool

BlinkPeriod

Cursor blink half-period in seconds. ≤ 0 disables blink.

public float BlinkPeriod { get; set; }

Property Value

float

CharFilter

Returns true if a character is allowed. Null = accept all.

public Func<char, bool> CharFilter { get; set; }

Property Value

Func<char, bool>

Cursor

public int Cursor { get; set; }

Property Value

int

HasSelection

public bool HasSelection { get; }

Property Value

bool

KeyboardType

Virtual keyboard layout requested on iOS / Android / mobile WebGL.

public TouchScreenKeyboardType KeyboardType { get; set; }

Property Value

TouchScreenKeyboardType

MaskChar

If set, displays this character for every input codepoint (password mode).

public char? MaskChar { get; set; }

Property Value

char?

MaxLength

Maximum UTF-16 length. Excess pastes are truncated.

public int MaxLength { get; set; }

Property Value

int

Placeholder

Text shown (dim) when Value is empty.

public string Placeholder { get; set; }

Property Value

string

Prefix

Fixed text drawn before the editable buffer (e.g. "> "). Not part of Value; not editable; ignored by selection/cursor logic. Empty disables.

public string Prefix { get; set; }

Property Value

string

PrefixBg

Background color of Prefix. Transparent (default) falls back to the body bg color.

public Color PrefixBg { get; set; }

Property Value

Color

PrefixFg

Foreground color of Prefix. Transparent (default) falls back to the body fg color.

public Color PrefixFg { get; set; }

Property Value

Color

ReadOnly

If true, editing keys and paste/cut are ignored. Selection + copy still work.

public bool ReadOnly { get; set; }

Property Value

bool

ScrollOffset

public int ScrollOffset { get; }

Property Value

int

SelectAllOnFocus

If true, OnFocus() will select all text.

public bool SelectAllOnFocus { get; set; }

Property Value

bool

SelectedText

public string SelectedText { get; }

Property Value

string

SelectionEnd

public int SelectionEnd { get; }

Property Value

int

SelectionStart

public int SelectionStart { get; }

Property Value

int

Value

public string Value { get; set; }

Property Value

string

Methods

ClearSelection()

public void ClearSelection()

Copy()

public bool Copy()

Returns

bool

Cut()

public bool Cut()

Returns

bool

DeleteBack()

public void DeleteBack()

DeleteForward()

public void DeleteForward()

DeleteWordBack()

public void DeleteWordBack()

DeleteWordForward()

public void DeleteWordForward()

HandleKeyEvent(TerminalKeyEvent)

public bool HandleKeyEvent(TerminalKeyEvent e)

Parameters

e TerminalKeyEvent

Returns

bool

HandleMouseEvent(TerminalMouseEvent)

public bool HandleMouseEvent(TerminalMouseEvent e)

Parameters

e TerminalMouseEvent

Returns

bool

InsertChar(char)

public void InsertChar(char c)

Parameters

c char

InsertString(string)

public void InsertString(string s)

Parameters

s string

MoveLeft(bool)

public void MoveLeft(bool extend)

Parameters

extend bool

MoveRight(bool)

public void MoveRight(bool extend)

Parameters

extend bool

MoveToEnd(bool)

public void MoveToEnd(bool extend)

Parameters

extend bool

MoveToStart(bool)

public void MoveToStart(bool extend)

Parameters

extend bool

MoveWordLeft(bool)

public void MoveWordLeft(bool extend)

Parameters

extend bool

MoveWordRight(bool)

public void MoveWordRight(bool extend)

Parameters

extend bool

OnBlur()

public void OnBlur()

OnFocus()

public void OnFocus()

Paste()

public bool Paste()

Returns

bool

Redo()

public bool Redo()

Returns

bool

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

Render the input field. Caller controls focus styling externally.

public void Render(RatatuiTerminal term, uint areaId, Color fg = default, Color bg = default, Color cursorFg = default, Color cursorBg = default, Color selectionFg = default, Color selectionBg = default, Color placeholderFg = default, bool focused = true)

Parameters

term RatatuiTerminal
areaId uint
fg Color
bg Color
cursorFg Color
cursorBg Color
selectionFg Color
selectionBg Color
placeholderFg Color
focused bool

Select(int, int)

public void Select(int start, int end)

Parameters

start int
end int

SelectAll()

public void SelectAll()

SyncMobileKeyboard()

public void SyncMobileKeyboard()

Undo()

public bool Undo()

Returns

bool