mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 00:36:07 +03:00
terminal: insertLines with count 0 no longer crashes
This commit is contained in:
@ -1226,6 +1226,9 @@ pub fn insertLines(self: *Terminal, count: usize) !void {
|
|||||||
const tracy = trace(@src());
|
const tracy = trace(@src());
|
||||||
defer tracy.end();
|
defer tracy.end();
|
||||||
|
|
||||||
|
// Rare, but happens
|
||||||
|
if (count == 0) return;
|
||||||
|
|
||||||
// Move the cursor to the left margin
|
// Move the cursor to the left margin
|
||||||
self.screen.cursor.x = 0;
|
self.screen.cursor.x = 0;
|
||||||
|
|
||||||
@ -1790,6 +1793,16 @@ test "Terminal: insertLines" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test "Terminal: insertLines zero" {
|
||||||
|
const alloc = testing.allocator;
|
||||||
|
var t = try init(alloc, 2, 5);
|
||||||
|
defer t.deinit(alloc);
|
||||||
|
|
||||||
|
// This should do nothing
|
||||||
|
t.setCursorPos(1, 1);
|
||||||
|
try t.insertLines(0);
|
||||||
|
}
|
||||||
|
|
||||||
test "Terminal: insertLines with scroll region" {
|
test "Terminal: insertLines with scroll region" {
|
||||||
const alloc = testing.allocator;
|
const alloc = testing.allocator;
|
||||||
var t = try init(alloc, 2, 6);
|
var t = try init(alloc, 2, 6);
|
||||||
|
Reference in New Issue
Block a user