From 648afa1fd5b4c2eb74b4292b4eceeeb6d93016c1 Mon Sep 17 00:00:00 2001 From: Ogulcan Celik Date: Thu, 4 Jun 2026 16:32:43 +0300 Subject: fix: backport libghostty resize overflow fix refs #465 --- vendor/libghostty-vt/src/terminal/c/terminal.zig | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'vendor/libghostty-vt/src/terminal/c') diff --git a/vendor/libghostty-vt/src/terminal/c/terminal.zig b/vendor/libghostty-vt/src/terminal/c/terminal.zig index 5a5db2d6..39959f83 100644 --- a/vendor/libghostty-vt/src/terminal/c/terminal.zig +++ b/vendor/libghostty-vt/src/terminal/c/terminal.zig @@ -1005,6 +1005,29 @@ test "resize invalid value" { try testing.expectEqual(Result.invalid_value, resize(t, 80, 0, 9, 18)); } +test "resize shrinks both axes with cursor at bottom" { + var t: Terminal = null; + try testing.expectEqual(Result.success, new( + &lib.alloc.test_allocator, + &t, + .{ + .cols = 80, + .rows = 24, + .max_scrollback = 0, + }, + )); + defer free(t); + + // CSI 24;1H parks the cursor on the bottom row. + const move = "\x1b[24;1H"; + vt_write(t, move, move.len); + + // Shrink both axes; pre-resize cursor.y sits past the new bottom row. + try testing.expectEqual(Result.success, resize(t, 79, 23, 8, 16)); + try testing.expectEqual(79, t.?.terminal.cols); + try testing.expectEqual(23, t.?.terminal.rows); +} + test "mode_get and mode_set" { var t: Terminal = null; try testing.expectEqual(Result.success, new( -- cgit v1.2.3