Class TerminalInputEncoder
Encodes Unity key events into terminal byte sequences suitable for feeding to a TerminalEmulator. Supports normal mode, application cursor keys mode, and modifier encoding.
Inherited Members
Namespace: Scylla.TextMode
Assembly: ScyllaTextMode.dll
Syntax
public static class TerminalInputEncoder
Methods
Encode(KeyCode, bool, bool, bool, bool)
Encodes a Unity key code into terminal byte sequence(s).
Declaration
public static byte[] Encode(KeyCode keyCode, bool shift, bool ctrl, bool alt, bool applicationCursorKeys)
Parameters
| Type | Name | Description |
|---|---|---|
| KeyCode | keyCode | The Unity key code. |
| bool | shift | Whether Shift is held. |
| bool | ctrl | Whether Ctrl is held. |
| bool | alt | Whether Alt is held. |
| bool | applicationCursorKeys | Whether application cursor keys mode is active. |
Returns
| Type | Description |
|---|---|
| byte[] | The encoded byte sequence, or null if the key has no encoding. |
EncodeChar(char, bool)
Encodes a character for terminal input. Handles Alt prefix (ESC + char) for characters.
Declaration
public static byte[] EncodeChar(char ch, bool alt)
Parameters
| Type | Name | Description |
|---|---|---|
| char | ch | The character to encode. |
| bool | alt | Whether Alt is held. |
Returns
| Type | Description |
|---|---|
| byte[] | The encoded byte sequence. |
EncodeMouse(TerminalMouseButton, int, int, bool, bool, MouseTrackingMode, MouseEncodingMode, bool, bool, bool)
Encodes a mouse event into an ANSI byte sequence for terminal mouse reporting.
Declaration
public static byte[] EncodeMouse(TerminalMouseButton button, int col, int row, bool pressed, bool motion, MouseTrackingMode trackingMode, MouseEncodingMode encodingMode, bool shift, bool ctrl, bool alt)
Parameters
| Type | Name | Description |
|---|---|---|
| TerminalMouseButton | button | The mouse button involved. |
| int | col | 1-based column coordinate. |
| int | row | 1-based row coordinate. |
| bool | pressed | True for press, false for release. |
| bool | motion | True if this is a motion event. |
| MouseTrackingMode | trackingMode | The active mouse tracking mode. |
| MouseEncodingMode | encodingMode | The active mouse encoding mode. |
| bool | shift | Whether Shift is held. |
| bool | ctrl | Whether Ctrl is held. |
| bool | alt | Whether Alt is held. |
Returns
| Type | Description |
|---|---|
| byte[] | The encoded byte sequence, or null if the event should not be reported. |
EncodePaste(string, bool)
Wraps pasted text in bracketed paste sequences if the mode is enabled.
Declaration
public static byte[] EncodePaste(string text, bool bracketedPasteMode)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | The pasted text. |
| bool | bracketedPasteMode | Whether bracketed paste mode is active. |
Returns
| Type | Description |
|---|---|
| byte[] | The encoded bytes for the paste operation. |