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
initialValuestring
Properties
Cursor
Cursor position as a character index [0..Value.Length].
public int Cursor { get; set; }
Property Value
ScrollOffset
Index of the first visible character (auto-managed during Render).
public int ScrollOffset { get; }
Property Value
Value
Current text content. Setting this clamps the cursor.
public string Value { get; set; }
Property Value
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
Returns
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
Returns
InsertChar(char)
public void InsertChar(char c)
Parameters
cchar
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
termRatatuiTerminalareaIduintfgColorText foreground color (Color.clear = terminal default white).
bgColorText background color (Color.clear = terminal default).
cursorFgColorCursor foreground (Color.clear = black).
cursorBgColorCursor background (Color.clear = white).