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
initialValuestring
Properties
AutoCorrection
Enable native autocorrection on the virtual keyboard.
public bool AutoCorrection { get; set; }
Property Value
BlinkPeriod
Cursor blink half-period in seconds. ≤ 0 disables blink.
public float BlinkPeriod { get; set; }
Property Value
CharFilter
Returns true if a character is allowed. Null = accept all.
public Func<char, bool> CharFilter { get; set; }
Property Value
Cursor
public int Cursor { get; set; }
Property Value
HasSelection
public bool HasSelection { get; }
Property Value
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
Placeholder
Text shown (dim) when Value is empty.
public string Placeholder { get; set; }
Property Value
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
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
ScrollOffset
public int ScrollOffset { get; }
Property Value
SelectAllOnFocus
If true, OnFocus() will select all text.
public bool SelectAllOnFocus { get; set; }
Property Value
SelectedText
public string SelectedText { get; }
Property Value
SelectionEnd
public int SelectionEnd { get; }
Property Value
SelectionStart
public int SelectionStart { get; }
Property Value
Value
public string Value { get; set; }
Property Value
Methods
ClearSelection()
public void ClearSelection()
Copy()
public bool Copy()
Returns
Cut()
public bool Cut()
Returns
DeleteBack()
public void DeleteBack()
DeleteForward()
public void DeleteForward()
DeleteWordBack()
public void DeleteWordBack()
DeleteWordForward()
public void DeleteWordForward()
HandleKeyEvent(TerminalKeyEvent)
public bool HandleKeyEvent(TerminalKeyEvent e)
Parameters
Returns
HandleMouseEvent(TerminalMouseEvent)
public bool HandleMouseEvent(TerminalMouseEvent e)
Parameters
Returns
InsertChar(char)
public void InsertChar(char c)
Parameters
cchar
InsertString(string)
public void InsertString(string s)
Parameters
sstring
MoveLeft(bool)
public void MoveLeft(bool extend)
Parameters
extendbool
MoveRight(bool)
public void MoveRight(bool extend)
Parameters
extendbool
MoveToEnd(bool)
public void MoveToEnd(bool extend)
Parameters
extendbool
MoveToStart(bool)
public void MoveToStart(bool extend)
Parameters
extendbool
MoveWordLeft(bool)
public void MoveWordLeft(bool extend)
Parameters
extendbool
MoveWordRight(bool)
public void MoveWordRight(bool extend)
Parameters
extendbool
OnBlur()
public void OnBlur()
OnFocus()
public void OnFocus()
Paste()
public bool Paste()
Returns
Redo()
public bool Redo()
Returns
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
termRatatuiTerminalareaIduintfgColorbgColorcursorFgColorcursorBgColorselectionFgColorselectionBgColorplaceholderFgColorfocusedbool
Select(int, int)
public void Select(int start, int end)
Parameters
SelectAll()
public void SelectAll()
SyncMobileKeyboard()
public void SyncMobileKeyboard()
Undo()
public bool Undo()