Files
ghostty/src/terminal/csi.zig
Mitchell Hashimoto f50aa90ced terminal: add lib.zig to centralize lib target and re-exports
Previously every file in the terminal package independently imported
build_options and ../lib/main.zig, then computed the same
lib_target constant. This was repetitive and meant each file needed
both imports just to get the target.

Introduce src/terminal/lib.zig which computes the target once and
re-exports the commonly used lib types (Enum, TaggedUnion, Struct,
String, checkGhosttyHEnum, structSizedFieldFits). All terminal
package files now import lib.zig and use lib.target instead of the
local lib_target constant, removing the per-file boilerplate.
2026-03-25 07:25:16 -07:00

56 lines
1.1 KiB
Zig

const lib = @import("lib.zig");
/// Modes for the ED CSI command.
pub const EraseDisplay = enum(u8) {
below = 0,
above = 1,
complete = 2,
scrollback = 3,
/// This is an extension added by Kitty to move the viewport into the
/// scrollback and then erase the display.
scroll_complete = 22,
};
/// Modes for the EL CSI command.
pub const EraseLine = enum(u8) {
right = 0,
left = 1,
complete = 2,
right_unless_pending_wrap = 4,
// Non-exhaustive so that @intToEnum never fails since the inputs are
// user-generated.
_,
};
/// Modes for the TBC (tab clear) command.
pub const TabClear = enum(u8) {
current = 0,
all = 3,
// Non-exhaustive so that @intToEnum never fails since the inputs are
// user-generated.
_,
};
/// Style formats for terminal size reports.
pub const SizeReportStyle = lib.Enum(
lib.target,
&.{
// XTWINOPS
"csi_14_t",
"csi_16_t",
"csi_18_t",
"csi_21_t",
},
);
/// XTWINOPS CSI 22/23
pub const TitlePushPop = struct {
op: Op,
index: u16,
pub const Op = enum { push, pop };
};