diff options
Diffstat (limited to 'src/layout.c')
-rw-r--r-- | src/layout.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/layout.c b/src/layout.c index f83976f..62e1876 100644 --- a/src/layout.c +++ b/src/layout.c | |||
@@ -6,6 +6,8 @@ | |||
6 | 6 | ||
7 | #include <cassert.h> | 7 | #include <cassert.h> |
8 | 8 | ||
9 | #define Min(a, b) ((a) < (b) ? (a) : (b)) | ||
10 | |||
9 | static void ResizeTable(uiTable* table, int width, int height) { | 11 | static void ResizeTable(uiTable* table, int width, int height) { |
10 | assert(table); | 12 | assert(table); |
11 | 13 | ||
@@ -16,7 +18,8 @@ static void ResizeTable(uiTable* table, int width, int height) { | |||
16 | table->height = height; | 18 | table->height = height; |
17 | 19 | ||
18 | // Compute the number of rows that are visible at once. | 20 | // Compute the number of rows that are visible at once. |
19 | table->num_visible_rows = height / g_ui.font->header.glyph_height; | 21 | table->num_visible_rows = |
22 | Min(table->rows, height / g_ui.font->header.glyph_height); | ||
20 | assert(table->num_visible_rows <= table->rows); | 23 | assert(table->num_visible_rows <= table->rows); |
21 | 24 | ||
22 | // Determine if there is vertical overflow. This determines whether we need to | 25 | // Determine if there is vertical overflow. This determines whether we need to |