macOS: change `window` to `new-window` for `macos-dock-drop-behavior`

Matches current option references and Swift implementation
pull/9764/head
Lukas 2025-11-30 20:45:18 +01:00
parent 7a1ff7779b
commit 91b4a218ca
No known key found for this signature in database
GPG Key ID: 845CB61BD38F4E49
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". // Ghostty 1.2 removed the "desktop" option and renamed it to "detect".
// The semantics also changed slightly but this is the correct mapping. // The semantics also changed slightly but this is the correct mapping.
.{ "gtk-single-instance", compatGtkSingleInstance }, .{ "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. /// The font families to use.
@ -2911,7 +2915,7 @@ keybind: Keybinds = .{},
/// ///
/// * `new-tab` - Create a new tab in the current window, or open /// * `new-tab` - Create a new tab in the current window, or open
/// a new window if none exist. /// 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`. /// The default value is `new-tab`.
/// ///
@ -4445,6 +4449,23 @@ fn compatBoldIsBright(
return true; 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. /// Add a diagnostic message to the config with the given string.
/// This is always added with a location of "none". /// This is always added with a location of "none".
pub fn addDiagnosticFmt( pub fn addDiagnosticFmt(
@ -7875,7 +7896,7 @@ pub const WindowNewTabPosition = enum {
/// See macos-dock-drop-behavior /// See macos-dock-drop-behavior
pub const MacOSDockDropBehavior = enum { pub const MacOSDockDropBehavior = enum {
@"new-tab", @"new-tab",
window, @"new-window",
}; };
/// See window-show-tab-bar /// See window-show-tab-bar
@ -9491,3 +9512,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",
);
}
}