renderer/size: move PaddingBalance enum out of Config

Previously WindowPaddingBalance was defined inside Config.zig, which
meant tests for renderer sizing had to pull in the full config
dependency. Move the enum into renderer/size.zig as PaddingBalance
and re-export it from Config so the public API is unchanged. This
lets size.zig tests run without depending on Config.
This commit is contained in:
Mitchell Hashimoto
2026-03-23 09:14:26 -07:00
parent 7253668ec2
commit f60587ffcc
2 changed files with 15 additions and 8 deletions

View File

@@ -39,6 +39,7 @@ pub const Path = @import("path.zig").Path;
pub const RepeatablePath = @import("path.zig").RepeatablePath;
const ClipboardCodepointMap = @import("ClipboardCodepointMap.zig");
const KeyRemapSet = @import("../input/key_mods.zig").RemapSet;
pub const WindowPaddingBalance = @import("../renderer/size.zig").PaddingBalance;
const string = @import("string.zig");
// We do this instead of importing all of terminal/main.zig to
@@ -5245,12 +5246,6 @@ pub const Fullscreen = enum(c_int) {
@"non-native-padded-notch",
};
pub const WindowPaddingBalance = enum {
false,
true,
equal,
};
pub const WindowPaddingColor = enum {
background,
extend,

View File

@@ -1,10 +1,22 @@
const std = @import("std");
const Allocator = std.mem.Allocator;
const configpkg = @import("../config.zig");
const terminal_size = @import("../terminal/size.zig");
const log = std.log.scoped(.renderer_size);
/// Controls how extra whitespace around the terminal grid is distributed.
pub const PaddingBalance = enum {
/// No balancing; padding is applied as specified explicitly.
false,
/// Balances padding but caps the top padding so the first row doesn't
/// drift too far from the top of the window. Excess vertical space is
/// shifted to the bottom.
true,
/// Distributes leftover space equally on all sides so the grid is
/// centered within the screen.
equal,
};
/// All relevant sizes for a rendered terminal. These are all the sizes that
/// any functionality should need to know about the terminal in order to
/// convert between any coordinate systems.
@@ -37,7 +49,7 @@ pub const Size = struct {
pub fn balancePadding(
self: *Size,
explicit: Padding,
mode: configpkg.Config.WindowPaddingBalance,
mode: PaddingBalance,
) void {
// This ensure grid() does the right thing
self.padding = explicit;