From a230c2b259254ab5be6d57bf985b89369e58fde7 Mon Sep 17 00:00:00 2001 From: Lawrence Chen <54008264+lawrencecchen@users.noreply.github.com> Date: Wed, 30 Sep 2026 14:56:00 -0700 Subject: [PATCH 1/2] config: failing test, c_get cannot read window-padding-x/-y cmux aligns its pane chrome to the terminal's first column and needs the user's window-padding-x. ghostty_config_get returns false for it: WindowPadding is a non-packed struct without cval. The test also pins window-padding-balance, which c_get already returns as its tag name. Co-Authored-By: Claude Opus 5.5 (1M context) --- src/config/c_get.zig | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/config/c_get.zig b/src/config/c_get.zig index 9bcb8d98225..811858fe505 100644 --- a/src/config/c_get.zig +++ b/src/config/c_get.zig @@ -238,3 +238,31 @@ test "c_get: split-preserve-zoom" { try testing.expect(get(&c, .@"split-preserve-zoom", @ptrCast(&bits))); try testing.expectEqual(@as(c_uint, 1), bits); } + +test "c_get: window padding" { + const testing = std.testing; + const alloc = testing.allocator; + + var c = try Config.default(alloc); + defer c.deinit(); + + // ghostty_config_window_padding_s + const Padding = extern struct { top_left: u32, bottom_right: u32 }; + c.@"window-padding-x" = .{ .top_left = 5, .bottom_right = 9 }; + c.@"window-padding-y" = .{ .top_left = 3, .bottom_right = 3 }; + + var x: Padding = undefined; + try testing.expect(get(&c, .@"window-padding-x", @ptrCast(&x))); + try testing.expectEqual(@as(u32, 5), x.top_left); + try testing.expectEqual(@as(u32, 9), x.bottom_right); + + var y: Padding = undefined; + try testing.expect(get(&c, .@"window-padding-y", @ptrCast(&y))); + try testing.expectEqual(@as(u32, 3), y.top_left); + try testing.expectEqual(@as(u32, 3), y.bottom_right); + + c.@"window-padding-balance" = .true; + var balance: [*:0]const u8 = undefined; + try testing.expect(get(&c, .@"window-padding-balance", @ptrCast(&balance))); + try testing.expectEqualStrings("true", std.mem.sliceTo(balance, 0)); +} From b1a49b6015235d2b36a8473ff5ae72aa16db82b0 Mon Sep 17 00:00:00 2001 From: Lawrence Chen <54008264+lawrencecchen@users.noreply.github.com> Date: Wed, 30 Sep 2026 14:56:26 -0700 Subject: [PATCH 2/2] config: c_get returns window-padding-x/-y as ghostty_config_window_padding_s WindowPadding gets a C mirror and cval, so ghostty_config_get fills a {top_left, bottom_right} pair of u32 points instead of returning false. cmux reads it to put its tab icons on the terminal's first text column. window-padding-balance already returns its tag name. ghostty.h declares ghostty_config_window_padding_s. Co-Authored-By: Claude Opus 5.5 (1M context) --- include/ghostty.h | 6 ++++++ src/config/Config.zig | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/ghostty.h b/include/ghostty.h index 3589f8f2b3f..a870140ff37 100644 --- a/include/ghostty.h +++ b/include/ghostty.h @@ -723,6 +723,12 @@ typedef struct { uint8_t b; } ghostty_config_color_s; +// config.WindowPadding.C (window-padding-x, window-padding-y), in points +typedef struct { + uint32_t top_left; + uint32_t bottom_right; +} ghostty_config_window_padding_s; + // config.ColorList typedef struct { const ghostty_config_color_s* colors; diff --git a/src/config/Config.zig b/src/config/Config.zig index ba23ccfdac2..46ca613b66e 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -10194,6 +10194,16 @@ pub const WindowPadding = struct { top_left: u32 = 0, bottom_right: u32 = 0, + /// ghostty_config_window_padding_s + pub const C = extern struct { + top_left: u32, + bottom_right: u32, + }; + + pub fn cval(self: Self) C { + return .{ .top_left = self.top_left, .bottom_right = self.bottom_right }; + } + pub fn clone(self: Self, _: Allocator) error{}!Self { return self; }