aboutsummaryrefslogtreecommitdiff
path: root/vendor/libghostty-vt/src/terminal/c
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-06-04 16:32:43 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-06-04 16:32:43 +0300
commit648afa1fd5b4c2eb74b4292b4eceeeb6d93016c1 (patch)
tree368bce0f173319b98bce0e99f0c829fcd54520b3 /vendor/libghostty-vt/src/terminal/c
parentf5f753c7286ff4cc30cfe3a9d48c053bfe2881c7 (diff)
fix: backport libghostty resize overflow fix
refs #465
Diffstat (limited to 'vendor/libghostty-vt/src/terminal/c')
-rw-r--r--vendor/libghostty-vt/src/terminal/c/terminal.zig23
1 files changed, 23 insertions, 0 deletions
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(