Merge pull request #1609 from gpanders/kitty-alt-reset

terminal: reset alt screen kitty keyboard state on full reset
This commit is contained in:
Mitchell Hashimoto
2024-03-26 06:46:48 -07:00
committed by GitHub

View File

@ -2368,6 +2368,7 @@ pub fn fullReset(self: *Terminal) void {
self.tabstops.reset(TABSTOP_INTERVAL);
self.screen.clearSelection();
self.screen.kitty_keyboard = .{};
self.secondary_screen.kitty_keyboard = .{};
self.screen.protected_mode = .off;
self.scrolling_region = .{
.top = 0,
@ -8226,6 +8227,25 @@ test "Terminal: fullReset status display" {
try testing.expect(t.status_display == .main);
}
// https://github.com/mitchellh/ghostty/issues/1607
test "Terminal: fullReset clears alt screen kitty keyboard state" {
var t = try init(testing.allocator, .{ .cols = 10, .rows = 10 });
defer t.deinit(testing.allocator);
t.alternateScreen(.{});
t.screen.kitty_keyboard.push(.{
.disambiguate = true,
.report_events = false,
.report_alternates = true,
.report_all = true,
.report_associated = true,
});
t.primaryScreen(.{});
t.fullReset();
try testing.expectEqual(0, t.secondary_screen.kitty_keyboard.current().int());
}
// https://github.com/mitchellh/ghostty/issues/272
// This is also tested in depth in screen resize tests but I want to keep
// this test around to ensure we don't regress at multiple layers.