+5
-3
src/vxfw/SplitView.zig
+5
-3
src/vxfw/SplitView.zig
···
88
88
},
89
89
.rhs => {
90
90
const last_max = self.last_max_width orelse return;
91
-
self.width = @min(last_max -| self.min_width, last_max -| mouse.col -| 1);
91
+
const mouse_col: u16 = if (mouse.col < 0) 0 else @intCast(mouse.col);
92
+
self.width = @min(last_max -| self.min_width, last_max -| mouse_col -| 1);
92
93
if (self.max_width) |max| {
93
94
self.width = @max(self.width, max);
94
95
}
···
218
219
// Send the widget a mouse press on the separator
219
220
var mouse: vaxis.Mouse = .{
220
221
// The separator is at width
221
-
.col = split_view.width,
222
+
.col = @intCast(split_view.width),
222
223
.row = 0,
223
224
.type = .press,
224
225
.button = .left,
···
241
242
try split_widget.handleEvent(&ctx, .{ .mouse = mouse });
242
243
try std.testing.expect(ctx.redraw);
243
244
try std.testing.expect(split_view.pressed);
244
-
try std.testing.expectEqual(mouse.col, split_view.width);
245
+
const mouse_col: u16 = if (mouse.col < 0) 0 else @intCast(mouse.col);
246
+
try std.testing.expectEqual(mouse_col, split_view.width);
245
247
}
246
248
247
249
test "refAllDecls" {