From d54d7cd5813cc5c98510220c90e184776f774773 Mon Sep 17 00:00:00 2001 From: Gregory Anders Date: Mon, 18 Mar 2024 15:07:56 -0500 Subject: [PATCH] terminal: set PageList viewport to active area when cloned As an optimization, the renderer does not attempt to find the cell under the cursor if the viewport is in the scrollback (i.e. not the active area). When the renderer clones the screen state it also clones the PageList, and the cloned PageList has its viewport set to the top of the scrollback. This caused the renderer to never attempt to find the cell under the cursor, which in turn caused cells under the cursor to be improperly highlighted. Instead, when the PageList is cloned initialize its viewport to the active area. --- src/terminal/PageList.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/terminal/PageList.zig b/src/terminal/PageList.zig index 8b2364bc6..a2918f604 100644 --- a/src/terminal/PageList.zig +++ b/src/terminal/PageList.zig @@ -306,7 +306,7 @@ pub const Clone = struct { /// Clone this pagelist from the top to bottom (inclusive). /// -/// The viewport is always moved to the top-left. +/// The viewport is always moved to the active area. /// /// The cloned pagelist must contain at least enough rows for the active /// area. If the region specified has less rows than the active area then @@ -478,7 +478,7 @@ pub fn clone( .cols = self.cols, .rows = self.rows, .tracked_pins = tracked_pins, - .viewport = .{ .top = {} }, + .viewport = .{ .active = {} }, .viewport_pin = viewport_pin, };