From 7c03077177c19988afb298e3514d809e4ba0946c Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Tue, 25 Jun 2024 09:07:33 -0500 Subject: [PATCH] window: use saturating sub in border calcs --- src/Window.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Window.zig b/src/Window.zig index 77cdb08..22ae978 100644 --- a/src/Window.zig +++ b/src/Window.zig @@ -182,8 +182,8 @@ pub fn child(self: Window, opts: ChildOptions) Window { const y_off: usize = if (loc.top) 1 else 0; const h_delt: usize = if (loc.bottom) 1 else 0; const w_delt: usize = if (loc.right) 1 else 0; - const h_ch: usize = h - y_off - h_delt; - const w_ch: usize = w - x_off - w_delt; + const h_ch: usize = h -| y_off -| h_delt; + const w_ch: usize = w -| x_off -| w_delt; return result.initChild(x_off, y_off, .{ .limit = w_ch }, .{ .limit = h_ch }); }