mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-25 13:16:11 +03:00
terminal: deleteLines assertion for same page
This commit is contained in:
@ -1348,8 +1348,7 @@ pub fn deleteLines(self: *Terminal, count_req: usize) void {
|
|||||||
// top is just the cursor position. insertLines starts at the cursor
|
// top is just the cursor position. insertLines starts at the cursor
|
||||||
// so this is our top. We want to shift lines down, down to the bottom
|
// so this is our top. We want to shift lines down, down to the bottom
|
||||||
// of the scroll region.
|
// of the scroll region.
|
||||||
const top: [*]Row = @ptrCast(self.screen.cursor.page_row);
|
const top = self.screen.cursor.page_pin.*;
|
||||||
var y: [*]Row = top;
|
|
||||||
|
|
||||||
// Remaining rows from our cursor to the bottom of the scroll region.
|
// Remaining rows from our cursor to the bottom of the scroll region.
|
||||||
const rem = self.scrolling_region.bottom - self.screen.cursor.y + 1;
|
const rem = self.scrolling_region.bottom - self.screen.cursor.y + 1;
|
||||||
@ -1366,10 +1365,14 @@ pub fn deleteLines(self: *Terminal, count_req: usize) void {
|
|||||||
const left_right = self.scrolling_region.left > 0 or
|
const left_right = self.scrolling_region.left > 0 or
|
||||||
self.scrolling_region.right < self.cols - 1;
|
self.scrolling_region.right < self.cols - 1;
|
||||||
|
|
||||||
const bottom: [*]Row = top + (scroll_amount - 1);
|
const bot = top.down(scroll_amount - 1).?;
|
||||||
while (@intFromPtr(y) <= @intFromPtr(bottom)) : (y += 1) {
|
var it = top.rowIterator(.right_down, bot);
|
||||||
const src: *Row = @ptrCast(y + count);
|
while (it.next()) |p| {
|
||||||
const dst: *Row = @ptrCast(y);
|
const src_p = p.down(count).?;
|
||||||
|
assert(src_p.page == p.page); // TODO: handle different pages
|
||||||
|
|
||||||
|
const src: *Row = src_p.rowAndCell().row;
|
||||||
|
const dst: *Row = p.rowAndCell().row;
|
||||||
|
|
||||||
if (!left_right) {
|
if (!left_right) {
|
||||||
// Swap the src/dst cells. This ensures that our dst gets the proper
|
// Swap the src/dst cells. This ensures that our dst gets the proper
|
||||||
@ -1392,9 +1395,11 @@ pub fn deleteLines(self: *Terminal, count_req: usize) void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const bottom: [*]Row = top + (rem - 1);
|
const clear_top = top.down(scroll_amount).?;
|
||||||
while (@intFromPtr(y) <= @intFromPtr(bottom)) : (y += 1) {
|
const bot = top.down(rem - 1).?;
|
||||||
const row: *Row = @ptrCast(y);
|
var it = clear_top.rowIterator(.right_down, bot);
|
||||||
|
while (it.next()) |p| {
|
||||||
|
const row: *Row = p.rowAndCell().row;
|
||||||
|
|
||||||
// Clear the src row.
|
// Clear the src row.
|
||||||
var page = &self.screen.cursor.page_pin.page.data;
|
var page = &self.screen.cursor.page_pin.page.data;
|
||||||
|
Reference in New Issue
Block a user