mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-05-29 16:25:20 +00:00
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:
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user