From 51d3c2cf351cbf378269f89561f3d412d90a387c Mon Sep 17 00:00:00 2001 From: Qwerasd Date: Sun, 31 Mar 2024 21:49:28 -0400 Subject: [PATCH] fix(kitty_graphics): set dirty state on various scroll operations --- src/terminal/Screen.zig | 3 +++ src/terminal/Terminal.zig | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/src/terminal/Screen.zig b/src/terminal/Screen.zig index 96c84ce9b..a295f0ce5 100644 --- a/src/terminal/Screen.zig +++ b/src/terminal/Screen.zig @@ -540,6 +540,9 @@ pub fn cursorDownScroll(self: *Screen) !void { assert(self.cursor.y == self.pages.rows - 1); defer self.assertIntegrity(); + // Scrolling dirties the images because it updates their placements pins. + self.kitty_images.dirty = true; + // If we have no scrollback, then we shift all our rows instead. if (self.no_scrollback) { // If we have a single-row screen, we have no rows to shift diff --git a/src/terminal/Terminal.zig b/src/terminal/Terminal.zig index 70bf9cfcc..d002b47ec 100644 --- a/src/terminal/Terminal.zig +++ b/src/terminal/Terminal.zig @@ -1075,6 +1075,9 @@ pub fn index(self: *Terminal) !void { self.screen.cursor.x >= self.scrolling_region.left and self.screen.cursor.x <= self.scrolling_region.right) { + // Scrolling dirties the images because it updates their placements pins. + self.screen.kitty_images.dirty = true; + // If our scrolling region is the full screen, we create scrollback. // Otherwise, we simply scroll the region. if (self.scrolling_region.top == 0 and @@ -1391,6 +1394,9 @@ pub fn insertLines(self: *Terminal, count: usize) void { self.screen.cursor.x < self.scrolling_region.left or self.screen.cursor.x > self.scrolling_region.right) return; + // Scrolling dirties the images because it updates their placements pins. + self.screen.kitty_images.dirty = true; + // Remaining rows from our cursor to the bottom of the scroll region. const rem = self.scrolling_region.bottom - self.screen.cursor.y + 1; @@ -1534,6 +1540,9 @@ pub fn deleteLines(self: *Terminal, count_req: usize) void { self.screen.cursor.x < self.scrolling_region.left or self.screen.cursor.x > self.scrolling_region.right) return; + // Scrolling dirties the images because it updates their placements pins. + self.screen.kitty_images.dirty = true; + // 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 // of the scroll region.