widgets(table): fixed an issue w/ active row contents causing the last few rows to disappear

This commit is contained in:
00JCIV00 2024-08-20 11:13:58 -04:00 committed by Tim Culverhouse
parent 2580a8fc12
commit eaa9c1580a

View file

@ -235,7 +235,7 @@ pub fn drawTable(
const max_items =
if (data_items.len > table_win.height -| 1) table_win.height -| 1 else data_items.len;
var end = table_ctx.start + max_items;
if (table_ctx.row + table_ctx.active_y_off >= end -| 1)
if (table_ctx.row + table_ctx.active_y_off >= win.height -| 2)
end -|= table_ctx.active_y_off;
if (end > data_items.len) end = data_items.len;
table_ctx.start = tableStart: {
@ -250,7 +250,7 @@ pub fn drawTable(
break :tableStart table_ctx.start;
};
end = table_ctx.start + max_items;
if (table_ctx.row + table_ctx.active_y_off >= end -| 1)
if (table_ctx.row + table_ctx.active_y_off >= win.height -| 2)
end -|= table_ctx.active_y_off;
if (end > data_items.len) end = data_items.len;
table_ctx.start = @min(table_ctx.start, end);