Class TextUtils
- Namespace
- RatatuiUnity
Codepoint iteration and terminal display-width helpers for text input widgets. All indices are .NET UTF-16 char positions; widths are terminal cell counts.
public static class TextUtils
- Inheritance
-
TextUtils
- Inherited Members
Methods
CodepointAt(string, int)
UTF-32 codepoint at the given char index, or 0 if past end.
public static int CodepointAt(string s, int index)
Parameters
Returns
CodepointDisplayWidth(int)
Terminal cell width of a single codepoint (1 or 2). Control chars return 0.
public static int CodepointDisplayWidth(int cp)
Parameters
cpint
Returns
CodepointSize(string, int)
Number of UTF-16 code units that make up the codepoint starting at index.
public static int CodepointSize(string s, int index)
Parameters
Returns
DisplayWidth(string, int, int)
Total display width of the substring [start, end).
public static int DisplayWidth(string s, int start, int end)
Parameters
Returns
IndexAtColumn(string, int)
Char index whose column ≥ targetColumn (clamped to s.Length).
public static int IndexAtColumn(string s, int targetColumn)
Parameters
Returns
IsWordCodepoint(int)
Determines if a codepoint is part of a word (for word-jump).
public static bool IsWordCodepoint(int cp)
Parameters
cpint
Returns
NextBoundary(string, int)
Char index of the next codepoint boundary at-or-after index.
public static int NextBoundary(string s, int index)
Parameters
Returns
PrevBoundary(string, int)
Char index of the previous codepoint boundary before index.
public static int PrevBoundary(string s, int index)