fix: integer overflow in scrollbar_v
This commit is contained in:
parent
8dbc5765d9
commit
4f60e906d7
1 changed files with 2 additions and 2 deletions
|
|
@ -196,14 +196,14 @@ const eighths_c: u32 = eighths_b.len;
|
|||
fn smooth_bar_at(plane: *Plane, pos_: u32, size_: u32) !void {
|
||||
const height: u32 = plane.dim_y();
|
||||
var size = @max(size_, 8);
|
||||
const pos = @min(height * eighths_c - size, pos_);
|
||||
const pos = @min(height * eighths_c -| size, pos_);
|
||||
var pos_y: c_int = @intCast(@divFloor(pos, eighths_c));
|
||||
const blk = @mod(pos, eighths_c);
|
||||
const b = eighths_b[blk];
|
||||
plane.erase();
|
||||
plane.cursor_move_yx(pos_y, 0) catch return;
|
||||
_ = try plane.putstr(@ptrCast(b));
|
||||
size -= eighths_c - blk;
|
||||
size -= eighths_c -| blk;
|
||||
while (size >= 8) {
|
||||
pos_y += 1;
|
||||
size -= 8;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue