mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-06-09 05:14:27 +00:00
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.
This commit is contained in:
@@ -9,16 +9,13 @@ const ScreenSet = @This();
|
||||
|
||||
const std = @import("std");
|
||||
const assert = @import("../quirks.zig").inlineAssert;
|
||||
const build_options = @import("terminal_options");
|
||||
const lib = @import("../lib/main.zig");
|
||||
const lib = @import("lib.zig");
|
||||
const testing = std.testing;
|
||||
const Allocator = std.mem.Allocator;
|
||||
const Screen = @import("Screen.zig");
|
||||
|
||||
const lib_target: lib.Target = if (build_options.c_abi) .c else .zig;
|
||||
|
||||
/// The possible keys for screens in the screen set.
|
||||
pub const Key = lib.Enum(lib_target, &.{
|
||||
pub const Key = lib.Enum(lib.target, &.{
|
||||
"primary",
|
||||
"alternate",
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user