terminal: insertLines resets wrap

This commit is contained in:
Mitchell Hashimoto
2023-09-25 16:17:22 -07:00
parent 961e836d67
commit 27cc8e5529

View File

@ -1546,6 +1546,7 @@ pub fn insertLines(self: *Terminal, count: usize) !void {
// Move the cursor to the left margin
self.screen.cursor.x = 0;
self.screen.cursor.pending_wrap = false;
// Remaining rows from our cursor
const rem = self.scrolling_region.bottom - self.screen.cursor.y + 1;
@ -2495,6 +2496,24 @@ test "Terminal: insertLines more than remaining" {
}
}
test "Terminal: insertLines resets wrap" {
const alloc = testing.allocator;
var t = try init(alloc, 5, 5);
defer t.deinit(alloc);
for ("ABCDE") |c| try t.print(c);
try testing.expect(t.screen.cursor.pending_wrap);
try t.insertLines(1);
try testing.expect(!t.screen.cursor.pending_wrap);
try t.print('B');
{
var str = try t.plainString(testing.allocator);
defer testing.allocator.free(str);
try testing.expectEqualStrings("B\nABCDE", str);
}
}
test "Terminal: reverseIndex" {
const alloc = testing.allocator;
var t = try init(alloc, 2, 5);