From 92978a10576d52a0f6c9983d3b6afae7c40eff40 Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Thu, 12 Mar 2026 15:29:23 -0700 Subject: Support scrolling by dragging scrollbars --- src/render.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src/render.c') diff --git a/src/render.c b/src/render.c index 20ab142..a242504 100644 --- a/src/render.c +++ b/src/render.c @@ -224,7 +224,7 @@ static void RenderTable(const uiTable* table, RenderState* state) { state->subsurface.width = table->widths[col]; state->pen.x = 0; - const uiCell* cell = GetCell(table, row, col); + const uiCell* cell = TableGetCell(table, row, col); RenderText(string_data(cell->text), string_length(cell->text), state); // Reset the original subsurface and pen for subsequent columns. @@ -242,14 +242,11 @@ static void RenderTable(const uiTable* table, RenderState* state) { if (table->flags.vertical_overflow) { state->pen.x = col_widths_sum; - const int y_start = (int)((double)table->offset / (double)table->rows * - (double)table->height); - - const int height = (int)((double)table->num_visible_rows / - (double)table->rows * (double)table->height); - + const uiScrollbar* scrollbar = &table->scrollbar; FillRect( - &(uiRect){.y = y_start, .width = ScrollBarWidth, .height = height}, + &(uiRect){.y = scrollbar->handle_y, + .width = ScrollbarWidth, + .height = scrollbar->handle_height}, uiPink, state); state->pen.x = x0; -- cgit v1.2.3