aboutsummaryrefslogtreecommitdiff
path: root/vendor/libghostty-vt/src/terminal/ansi.zig
diff options
context:
space:
mode:
authorCan Celik <ogulcancelik@gmail.com>2026-04-04 19:22:04 +0300
committerCan Celik <ogulcancelik@gmail.com>2026-04-05 01:23:06 +0300
commit41dd733ca7123c9ac4bfc6c781697a660e95b052 (patch)
tree3fc91815ca139ef2e0b281bba0abda4ef15175f4 /vendor/libghostty-vt/src/terminal/ansi.zig
parent55c138263e190a1e79d4b997bfb9397306c0ec1f (diff)
feat: finish ghostty pane backend integration
Diffstat (limited to 'vendor/libghostty-vt/src/terminal/ansi.zig')
-rw-r--r--vendor/libghostty-vt/src/terminal/ansi.zig106
1 files changed, 106 insertions, 0 deletions
diff --git a/vendor/libghostty-vt/src/terminal/ansi.zig b/vendor/libghostty-vt/src/terminal/ansi.zig
new file mode 100644
index 00000000..4e777b7c
--- /dev/null
+++ b/vendor/libghostty-vt/src/terminal/ansi.zig
@@ -0,0 +1,106 @@
+const lib = @import("lib.zig");
+
+/// C0 (7-bit) control characters from ANSI.
+///
+/// This is not complete, control characters are only added to this
+/// as the terminal emulator handles them.
+pub const C0 = enum(u7) {
+ /// Null
+ NUL = 0x00,
+ /// Start of heading
+ SOH = 0x01,
+ /// Start of text
+ STX = 0x02,
+ /// Enquiry
+ ENQ = 0x05,
+ /// Bell
+ BEL = 0x07,
+ /// Backspace
+ BS = 0x08,
+ // Horizontal tab
+ HT = 0x09,
+ /// Line feed
+ LF = 0x0A,
+ /// Vertical Tab
+ VT = 0x0B,
+ /// Form feed
+ FF = 0x0C,
+ /// Carriage return
+ CR = 0x0D,
+ /// Shift out
+ SO = 0x0E,
+ /// Shift in
+ SI = 0x0F,
+
+ // Non-exhaustive so that @intToEnum never fails since the inputs are
+ // user-generated.
+ _,
+};
+
+/// The SGR rendition aspects that can be set, sometimes known as attributes.
+/// The value corresponds to the parameter value for the SGR command (ESC [ m).
+pub const RenditionAspect = enum(u16) {
+ default = 0,
+ bold = 1,
+ default_fg = 39,
+ default_bg = 49,
+
+ // Non-exhaustive so that @intToEnum never fails since the inputs are
+ // user-generated.
+ _,
+};
+
+/// Possible cursor styles (ESC [ q)
+pub const CursorStyle = lib.Enum(
+ lib.target,
+ &.{
+ "default",
+ "blinking_block",
+ "steady_block",
+ "blinking_underline",
+ "steady_underline",
+ "blinking_bar",
+ "steady_bar",
+ },
+);
+
+/// The status line type for DECSSDT.
+pub const StatusLineType = enum(u16) {
+ none = 0,
+ indicator = 1,
+ host_writable = 2,
+
+ // Non-exhaustive so that @intToEnum never fails for unsupported values.
+ _,
+};
+
+/// The display to target for status updates (DECSASD).
+pub const StatusDisplay = lib.Enum(
+ lib.target,
+ &.{
+ "main",
+ "status_line",
+ },
+);
+
+/// The possible modify key formats to ESC[>{a};{b}m
+/// Note: this is not complete, we should add more as we support more
+pub const ModifyKeyFormat = lib.Enum(
+ lib.target,
+ &.{
+ "legacy",
+ "cursor_keys",
+ "function_keys",
+ "other_keys_none",
+ "other_keys_numeric_except",
+ "other_keys_numeric",
+ },
+);
+
+/// The protection modes that can be set for the terminal. See DECSCA and
+/// ESC V, W.
+pub const ProtectedMode = enum {
+ off,
+ iso, // ESC V, W
+ dec, // CSI Ps " q
+};