macOS: change `window` to `new-window` for `macos-dock-drop-behavior` (#9764)

Matches current option references and Swift implementation
pull/9469/merge
Mitchell Hashimoto 2025-12-16 13:35:25 -08:00 committed by GitHub
commit 50cb1bafd7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 42 additions and 2 deletions

View File

@ -86,6 +86,10 @@ pub const compatibility = std.StaticStringMap(
// Ghostty 1.2 removed the "desktop" option and renamed it to "detect".
// The semantics also changed slightly but this is the correct mapping.
.{ "gtk-single-instance", compatGtkSingleInstance },
// Ghostty 1.3 rename the "window" option to "new-window".
// See: https://github.com/ghostty-org/ghostty/pull/9764
.{ "macos-dock-drop-behavior", compatMacOSDockDropBehavior },
});
/// The font families to use.
@ -2936,7 +2940,7 @@ keybind: Keybinds = .{},
///
/// * `new-tab` - Create a new tab in the current window, or open
/// a new window if none exist.
/// * `window` - Create a new window unconditionally.
/// * `new-window` - Create a new window unconditionally.
///
/// The default value is `new-tab`.
///
@ -4470,6 +4474,23 @@ fn compatBoldIsBright(
return true;
}
fn compatMacOSDockDropBehavior(
self: *Config,
alloc: Allocator,
key: []const u8,
value: ?[]const u8,
) bool {
_ = alloc;
assert(std.mem.eql(u8, key, "macos-dock-drop-behavior"));
if (std.mem.eql(u8, value orelse "", "window")) {
self.@"macos-dock-drop-behavior" = .@"new-window";
return true;
}
return false;
}
/// Add a diagnostic message to the config with the given string.
/// This is always added with a location of "none".
pub fn addDiagnosticFmt(
@ -7904,7 +7925,7 @@ pub const WindowNewTabPosition = enum {
/// See macos-dock-drop-behavior
pub const MacOSDockDropBehavior = enum {
@"new-tab",
window,
@"new-window",
};
/// See window-show-tab-bar
@ -9561,3 +9582,22 @@ test "compatibility: removed bold-is-bright" {
);
}
}
test "compatibility: window new-window" {
const testing = std.testing;
const alloc = testing.allocator;
{
var cfg = try Config.default(alloc);
defer cfg.deinit();
var it: TestIterator = .{ .data = &.{
"--macos-dock-drop-behavior=window",
} };
try cfg.loadIter(alloc, &it);
try cfg.finalize();
try testing.expectEqual(
MacOSDockDropBehavior.@"new-window",
cfg.@"macos-dock-drop-behavior",
);
}
}