diff --git a/src/widgets/table/table.zig b/src/widgets/table/table.zig index 7af2832..7248146 100644 --- a/src/widgets/table/table.zig +++ b/src/widgets/table/table.zig @@ -143,6 +143,10 @@ pub fn tableRectFull( const content_h = bounds.h -| header_h; const visible_rows: usize = @intCast(content_h / config.row_height); + // Begin clipping to entire table bounds + // This prevents header and cell text from drawing outside the table area + ctx.pushCommand(Command.clip(bounds.x, bounds.y, bounds.w, bounds.h)); + // Draw header if enabled if (config.show_headers) { const header_result = render.drawHeader(ctx, bounds, table_state, columns, state_col_w, config, colors); @@ -153,11 +157,6 @@ pub fn tableRectFull( } } - // Begin clipping to table content area (excludes header) - // This prevents cell text from drawing outside the table bounds - const content_y = bounds.y + @as(i32, @intCast(header_h)); - ctx.pushCommand(Command.clip(bounds.x, content_y, bounds.w, content_h)); - // Calculate visible row range const first_visible = table_state.scroll_row; const last_visible = @min(first_visible + visible_rows, table_state.row_count);