terminal/kitty: do not render blank virtual placement cells

This commit is contained in:
Mitchell Hashimoto
2024-07-29 14:52:09 -07:00
parent 39b915ac25
commit 0c81ca44b8
2 changed files with 10 additions and 0 deletions

View File

@ -1694,6 +1694,9 @@ fn prepKittyVirtualPlacement(
return; return;
}; };
// If our placement is zero sized then we don't do anything.
if (rp.dest_width == 0 or rp.dest_height == 0) return;
const viewport: terminal.point.Point = t.screen.pages.pointFromPin( const viewport: terminal.point.Point = t.screen.pages.pointFromPin(
.viewport, .viewport,
rp.top_left, rp.top_left,

View File

@ -293,6 +293,13 @@ pub const Placement = struct {
width = img_scale_source.width * p_scale.x_scale; width = img_scale_source.width * p_scale.x_scale;
} }
// If our modified source width/height is less than zero then
// we render nothing because it means we're rendering outside
// of the visible image.
if (img_scale_source.width <= 0 or img_scale_source.height <= 0) {
return .{ .top_left = self.pin };
}
break :dest .{ break :dest .{
.x_offset = x_offset * p_scale.x_scale, .x_offset = x_offset * p_scale.x_scale,
.y_offset = y_offset * p_scale.y_scale, .y_offset = y_offset * p_scale.y_scale,