diff --git a/src/widgets/virtual_list/virtual_list.zig b/src/widgets/virtual_list/virtual_list.zig index 7320056..85197ad 100644 --- a/src/widgets/virtual_list/virtual_list.zig +++ b/src/widgets/virtual_list/virtual_list.zig @@ -464,18 +464,17 @@ fn handleKeyboard( _ = provider; _ = result; - if (ctx.input.keyPressed(.up)) { - list_state.moveUp(); - } else if (ctx.input.keyPressed(.down)) { - list_state.moveDown(visible_rows); - } else if (ctx.input.keyPressed(.page_up)) { - list_state.pageUp(visible_rows); - } else if (ctx.input.keyPressed(.page_down)) { - list_state.pageDown(visible_rows, total_rows); - } else if (ctx.input.keyPressed(.home)) { - list_state.goToStart(); - } else if (ctx.input.keyPressed(.end)) { - list_state.goToEnd(visible_rows, total_rows); + // Usar navKeyPressed() para soportar key repeat (tecla mantenida pulsada) + if (ctx.input.navKeyPressed()) |key| { + switch (key) { + .up => list_state.moveUp(), + .down => list_state.moveDown(visible_rows), + .page_up => list_state.pageUp(visible_rows), + .page_down => list_state.pageDown(visible_rows, total_rows), + .home => list_state.goToStart(), + .end => list_state.goToEnd(visible_rows, total_rows), + else => {}, + } } }