+2
-4
src/widgets/Table.zig
+2
-4
src/widgets/Table.zig
···
161
161
var hdr = vaxis.widgets.alignment.center(hdr_win, @min(col_width -| 1, hdr_txt.len +| 1), 1);
162
162
hdr_win.fill(.{ .style = .{ .bg = hdr_bg } });
163
163
var seg = [_]vaxis.Cell.Segment{.{
164
-
.text = if (hdr_txt.len > table_ctx.col_width and alloc != null) try fmt.allocPrint(alloc.?, "{s}...", .{hdr_txt[0..(table_ctx.col_width -| 4)]}) else hdr_txt,
164
+
.text = if (hdr_txt.len > col_width and alloc != null) try fmt.allocPrint(alloc.?, "{s}...", .{hdr_txt[0..(col_width -| 4)]}) else hdr_txt,
165
165
.style = .{
166
166
.bg = hdr_bg,
167
167
.bold = true,
···
213
213
});
214
214
if (table_ctx.start + row == table_ctx.row) {
215
215
table_ctx.active_y_off = if (table_ctx.active_content_fn) |content| try content(&row_win, table_ctx.active_ctx) else 0;
216
-
//if (table_ctx.row + table_ctx.active_y_off >= end)
217
-
// try drawTable(alloc, win, headers, data_list, table_ctx);
218
216
}
219
217
const DataT = @TypeOf(data);
220
218
col_start = 0;
···
256
254
};
257
255
item_win.fill(.{ .style = .{ .bg = row_bg } });
258
256
var seg = [_]vaxis.Cell.Segment{.{
259
-
.text = if (item_txt.len > table_ctx.col_width and alloc != null) try fmt.allocPrint(alloc.?, "{s}...", .{item_txt[0..(table_ctx.col_width -| 4)]}) else item_txt,
257
+
.text = if (item_txt.len > col_width and alloc != null) try fmt.allocPrint(alloc.?, "{s}...", .{item_txt[0..(col_width -| 4)]}) else item_txt,
260
258
.style = .{ .bg = row_bg },
261
259
}};
262
260
_ = try item_win.print(seg[0..], .{ .wrap = .word });