this repo has no description
13
fork

Configure Feed

Select the types of activity you want to include in your feed.

widgets(table): improved type and bounds checks

- Improved the Type checks for MultiArrayList child Types.
- Improved the bounds checking for printing rows.

authored by

00JCIV00 and committed by
Tim Culverhouse
2580a8fc a17c4af2

+7 -3
+2 -2
examples/table.zig
··· 279 279 event_alloc, 280 280 middle_bar, 281 281 //users_buf[0..], 282 - user_list, 283 - //user_mal, 282 + //user_list, 283 + user_mal, 284 284 &demo_tbl, 285 285 ); 286 286 }
+5 -1
src/widgets/Table.zig
··· 144 144 if (alloc) |_alloc| { 145 145 di_is_mal = true; 146 146 const mal_slice = data_list.slice(); 147 - const DataT = @TypeOf(mal_slice.get(0)); 147 + const DataT = dataType: { 148 + const fn_info = @typeInfo(@TypeOf(@field(@TypeOf(mal_slice), "get"))); 149 + break :dataType fn_info.Fn.return_type orelse @panic("No Child Type"); 150 + }; 148 151 var data_out_list = std.ArrayList(DataT).init(_alloc); 149 152 for (0..mal_slice.len) |idx| try data_out_list.append(mal_slice.get(idx)); 150 153 break :getData try data_out_list.toOwnedSlice(); ··· 250 253 if (table_ctx.row + table_ctx.active_y_off >= end -| 1) 251 254 end -|= table_ctx.active_y_off; 252 255 if (end > data_items.len) end = data_items.len; 256 + table_ctx.start = @min(table_ctx.start, end); 253 257 table_ctx.active_y_off = 0; 254 258 for (data_items[table_ctx.start..end], 0..) |data, row| { 255 259 const row_fg,