From 89188be968ac39e0e12077e6b596efaf00d06986 Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Sun, 8 Mar 2026 10:12:57 -0700 Subject: Store strings inside table cells for simplicity --- src/layout.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/layout.c') diff --git a/src/layout.c b/src/layout.c index 62e1876..2b43ce8 100644 --- a/src/layout.c +++ b/src/layout.c @@ -44,22 +44,18 @@ static void ResizeTable(uiTable* table, int width, int height) { int* widths = table->widths; // Header. for (int col = 0; col < table->cols; ++col) { - const uiCell* cell = &table->header[col]; - const uiLabel* label = (uiLabel*)cell->child; - const int length = (int)string_length(label->text); + const uiCell* cell = &table->header[col]; + const int length = (int)string_length(cell->text); widths[col] = length; } // Table contents. for (int row = 0; row < table->rows; ++row) { for (int col = 0; col < table->cols; ++col) { - const uiCell* cell = GetCell(table, row, col); - if (cell->child) { - const uiLabel* label = (uiLabel*)cell->child; - const int length = (int)string_length(label->text); + const uiCell* cell = GetCell(table, row, col); + const int length = (int)string_length(cell->text); - widths[col] = length > widths[col] ? length : widths[col]; - } + widths[col] = length > widths[col] ? length : widths[col]; } } // Multiply string lengths times glyph width to compute pixel size. -- cgit v1.2.3