Table of Contents

Class TerminalCommandInput

Namespace
RatatuiUnity

A reusable command-line input built on top of TerminalInput. Adds the keystrokes a console/REPL needs (Enter/Escape/Tab/Up/Down) as events, while delegating editing (typing, selection, clipboard, undo/redo, horizontal scroll, mobile IME) to the underlying widget.

Composition rather than inheritance: TerminalInput methods are not virtual, but its public API is rich enough that a wrapper can drive it.

public class TerminalCommandInput
Inheritance
TerminalCommandInput
Inherited Members

Properties

Cursor

public int Cursor { get; set; }

Property Value

int

HasSelection

public bool HasSelection { get; }

Property Value

bool

Input

public TerminalInput Input { get; }

Property Value

TerminalInput

Placeholder

public string Placeholder { get; set; }

Property Value

string

Prefix

public string Prefix { get; set; }

Property Value

string

PrefixBg

public Color PrefixBg { get; set; }

Property Value

Color

PrefixFg

public Color PrefixFg { get; set; }

Property Value

Color

ReadOnly

public bool ReadOnly { get; set; }

Property Value

bool

Text

public string Text { get; set; }

Property Value

string

Methods

HandleKeyEvent(TerminalKeyEvent)

public bool HandleKeyEvent(TerminalKeyEvent e)

Parameters

e TerminalKeyEvent

Returns

bool

HandleMouseEvent(TerminalMouseEvent)

public bool HandleMouseEvent(TerminalMouseEvent e)

Parameters

e TerminalMouseEvent

Returns

bool

OnBlur()

public void OnBlur()

OnFocus()

public void OnFocus()

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

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

Events

OnEdit

Fires whenever a key event mutated Text. Useful for resetting external history-search state on any kind of edit (typing, paste, cut, undo, delete-word, …) without enumerating individual keys.

public event Action OnEdit

Event Type

Action

OnEscape

Escape pressed. The wrapper consumes the key.

public event Action OnEscape

Event Type

Action

OnHistoryStep

UpArrow → -1, DownArrow → +1. Only fires when no modifier is held so Cmd/Ctrl-modified arrows fall through to TerminalInput.

public event Action<int> OnHistoryStep

Event Type

Action<int>

OnShiftTab

Shift+Tab pressed. Consumed only if a handler is attached.

public event Action OnShiftTab

Event Type

Action

OnSubmit

Enter or KeypadEnter pressed. The wrapper consumes the key.

public event Action OnSubmit

Event Type

Action

OnTab

Tab pressed (no Shift). Consumed only if a handler is attached.

public event Action OnTab

Event Type

Action