terminal: DL should reset wrap

This commit is contained in:
Mitchell Hashimoto
2023-09-25 16:13:07 -07:00
parent 806ce6d399
commit 961e836d67

View File

@ -1601,6 +1601,7 @@ pub fn deleteLines(self: *Terminal, count: usize) !void {
// Move the cursor to the left margin // Move the cursor to the left margin
self.screen.cursor.x = 0; self.screen.cursor.x = 0;
self.screen.cursor.pending_wrap = false;
// Perform the scroll // Perform the scroll
self.screen.scrollRegionUp( self.screen.scrollRegionUp(
@ -2367,6 +2368,24 @@ test "Terminal: deleteLines with scroll region, cursor outside of region" {
} }
} }
test "Terminal: deleteLines 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.deleteLines(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", str);
}
}
test "Terminal: insertLines" { test "Terminal: insertLines" {
const alloc = testing.allocator; const alloc = testing.allocator;
var t = try init(alloc, 2, 5); var t = try init(alloc, 2, 5);