From fcc0ea0c7c99a47c36c4fcaf8391e63cf280a27a Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 25 Mar 2024 20:10:03 -0700 Subject: [PATCH] terminal: explicit error set for page clone --- src/terminal/page.zig | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/terminal/page.zig b/src/terminal/page.zig index 90148e85d..dc73c9fce 100644 --- a/src/terminal/page.zig +++ b/src/terminal/page.zig @@ -433,6 +433,8 @@ pub const Page = struct { return result; } + pub const CloneFromError = Allocator.Error || style.Set.UpsertError; + /// Clone the contents of another page into this page. The capacities /// can be different, but the size of the other page must fit into /// this page. @@ -450,7 +452,7 @@ pub const Page = struct { other: *const Page, y_start: usize, y_end: usize, - ) !void { + ) CloneFromError!void { assert(y_start <= y_end); assert(y_end <= other.size.rows); assert(y_end - y_start <= self.size.rows); @@ -473,7 +475,7 @@ pub const Page = struct { other: *const Page, dst_row: *Row, src_row: *const Row, - ) !void { + ) CloneFromError!void { try self.clonePartialRowFrom( other, dst_row, @@ -492,7 +494,7 @@ pub const Page = struct { src_row: *const Row, x_start: usize, x_end_req: usize, - ) !void { + ) CloneFromError!void { const cell_len = @min(self.size.cols, other.size.cols); const x_end = @min(x_end_req, cell_len); assert(x_start <= x_end);