mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-19 22:10:29 +00:00
vt: fix test failures in render and key_encode
The colors_get function used structSizedFieldFits to guard the palette copy, which required the entire palette array to fit in the provided size. This prevented partial palette writes when the caller passed a truncated sized struct, since the guard failed even though the inner code already handled partial copies correctly. Remove the outer guard so the existing partial-copy logic applies. The setopt_from_terminal test expected alt_esc_prefix to be false on a fresh terminal, but the mode definition in modes.zig sets its default to true. Update the test expectation to match.
This commit is contained in:
@@ -259,7 +259,7 @@ test "setopt_from_terminal" {
|
||||
|
||||
// Options should reflect defaults from a fresh terminal
|
||||
try testing.expect(!e.?.opts.cursor_key_application);
|
||||
try testing.expect(!e.?.opts.alt_esc_prefix);
|
||||
try testing.expect(e.?.opts.alt_esc_prefix);
|
||||
try testing.expectEqual(KittyFlags.disabled, e.?.opts.kitty_flags);
|
||||
try testing.expectEqual(OptionAsAlt.false, e.?.opts.macos_option_as_alt);
|
||||
}
|
||||
|
||||
@@ -337,11 +337,7 @@ pub fn colors_get(
|
||||
out_colors.cursor_has_value = colors.cursor != null;
|
||||
}
|
||||
|
||||
if (lib.structSizedFieldFits(
|
||||
Colors,
|
||||
out_size,
|
||||
"palette",
|
||||
)) {
|
||||
{
|
||||
const palette_offset = @offsetOf(Colors, "palette");
|
||||
if (out_size > palette_offset) {
|
||||
const available = out_size - palette_offset;
|
||||
|
||||
Reference in New Issue
Block a user