Added some various integer overflow protections
This commit is contained in:
parent
32a4b4baab
commit
8d842c8b44
3 changed files with 5 additions and 3 deletions
|
@ -288,7 +288,7 @@ pub fn print(self: Window, segments: []const Segment, opts: PrintOptions) !Print
|
|||
if (row >= self.height) break :blk true;
|
||||
const s = grapheme.bytes(segment.text);
|
||||
if (std.mem.eql(u8, s, "\n")) {
|
||||
row += 1;
|
||||
row +|= 1;
|
||||
col = 0;
|
||||
continue;
|
||||
}
|
||||
|
@ -433,7 +433,7 @@ pub fn print(self: Window, segments: []const Segment, opts: PrintOptions) !Print
|
|||
.style = segment.style,
|
||||
.link = segment.link,
|
||||
});
|
||||
col += w;
|
||||
col +|= w;
|
||||
}
|
||||
} else false;
|
||||
return .{
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
//! Specialized TUI Widgets
|
||||
|
||||
pub const border = @import("widgets/border.zig");
|
||||
pub const alignment = @import("widgets/alignment.zig");
|
||||
pub const Scrollbar = @import("widgets/Scrollbar.zig");
|
||||
|
|
|
@ -70,7 +70,7 @@ pub fn drawTable(
|
|||
.{ .limit = item_width },
|
||||
.{ .limit = 1 },
|
||||
);
|
||||
var hdr = vaxis.widgets.alignment.center(hdr_win, @min(item_width - 1, hdr_txt.len), 1);
|
||||
var hdr = vaxis.widgets.alignment.center(hdr_win, @min(item_width - 1, hdr_txt.len + 1), 1);
|
||||
hdr_win.fill(.{ .style = .{ .bg = hdr_bg } });
|
||||
var seg = [_]vaxis.Cell.Segment{ .{
|
||||
.text = hdr_txt,
|
||||
|
|
Loading…
Reference in a new issue