a modern tui library written in zig

screen: add error union to return type

Changed files
+3 -5
src
+1 -1
src/Screen.zig
··· 29 29 mouse_shape: Shape = .default, 30 30 cursor_shape: Cell.CursorShape = .default, 31 31 32 - pub fn init(alloc: std.mem.Allocator, winsize: Winsize, unicode: *const Unicode) !Screen { 32 + pub fn init(alloc: std.mem.Allocator, winsize: Winsize, unicode: *const Unicode) std.mem.Allocator.Error!Screen { 33 33 const w = winsize.cols; 34 34 const h = winsize.rows; 35 35 const self = Screen{
+2 -4
src/View.zig
··· 25 25 }; 26 26 27 27 /// Initialize a new View 28 - pub fn init(alloc: mem.Allocator, unicode: *const Unicode, config: Config) !View { 28 + pub fn init(alloc: mem.Allocator, unicode: *const Unicode, config: Config) mem.Allocator.Error!View { 29 29 const screen = try Screen.init( 30 30 alloc, 31 31 .{ ··· 115 115 x = @min(x, self.screen.width -| width); 116 116 y = @min(y, self.screen.height -| height); 117 117 const child = win.child(.{ 118 - .x_off = x, 119 - .y_off = y, 120 118 .width = .{ .limit = width }, 121 119 .height = .{ .limit = height }, 122 120 }); 123 - self.draw(child, .{}); 121 + self.draw(child, .{ .x_off = x, .y_off = y }); 124 122 return .{ x, y }; 125 123 } 126 124