mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-17 01:06:08 +03:00
terminal: explicit error set for page clone
This commit is contained in:
@ -433,6 +433,8 @@ pub const Page = struct {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub const CloneFromError = Allocator.Error || style.Set.UpsertError;
|
||||||
|
|
||||||
/// Clone the contents of another page into this page. The capacities
|
/// Clone the contents of another page into this page. The capacities
|
||||||
/// can be different, but the size of the other page must fit into
|
/// can be different, but the size of the other page must fit into
|
||||||
/// this page.
|
/// this page.
|
||||||
@ -450,7 +452,7 @@ pub const Page = struct {
|
|||||||
other: *const Page,
|
other: *const Page,
|
||||||
y_start: usize,
|
y_start: usize,
|
||||||
y_end: usize,
|
y_end: usize,
|
||||||
) !void {
|
) CloneFromError!void {
|
||||||
assert(y_start <= y_end);
|
assert(y_start <= y_end);
|
||||||
assert(y_end <= other.size.rows);
|
assert(y_end <= other.size.rows);
|
||||||
assert(y_end - y_start <= self.size.rows);
|
assert(y_end - y_start <= self.size.rows);
|
||||||
@ -473,7 +475,7 @@ pub const Page = struct {
|
|||||||
other: *const Page,
|
other: *const Page,
|
||||||
dst_row: *Row,
|
dst_row: *Row,
|
||||||
src_row: *const Row,
|
src_row: *const Row,
|
||||||
) !void {
|
) CloneFromError!void {
|
||||||
try self.clonePartialRowFrom(
|
try self.clonePartialRowFrom(
|
||||||
other,
|
other,
|
||||||
dst_row,
|
dst_row,
|
||||||
@ -492,7 +494,7 @@ pub const Page = struct {
|
|||||||
src_row: *const Row,
|
src_row: *const Row,
|
||||||
x_start: usize,
|
x_start: usize,
|
||||||
x_end_req: usize,
|
x_end_req: usize,
|
||||||
) !void {
|
) CloneFromError!void {
|
||||||
const cell_len = @min(self.size.cols, other.size.cols);
|
const cell_len = @min(self.size.cols, other.size.cols);
|
||||||
const x_end = @min(x_end_req, cell_len);
|
const x_end = @min(x_end_req, cell_len);
|
||||||
assert(x_start <= x_end);
|
assert(x_start <= x_end);
|
||||||
|
Reference in New Issue
Block a user