diff --git a/tui.c b/tui.c index 9ea1a3c..4a74405 100644 --- a/tui.c +++ b/tui.c @@ -329,6 +329,9 @@ static void draw_fuzzy_search(void) { attroff(A_REVERSE); } } + + // Draw help line + mvprintw(start_y + height + 2, start_x, "j/k: navigate, h/l: page, Enter: select, Esc: cancel"); } // Handle fuzzy search input @@ -370,18 +373,34 @@ static bool handle_fuzzy_search(int ch) { } return true; } - case KEY_UP: { + case 'k': case KEY_UP: { if (fuzzy_search.selected_index > 0) { fuzzy_search.selected_index--; } return true; } - case KEY_DOWN: { + case 'j': case KEY_DOWN: { if (fuzzy_search.selected_index < fuzzy_search.num_results - 1) { fuzzy_search.selected_index++; } return true; } + case 'h': { + // Page up - move up by 10 items + fuzzy_search.selected_index -= 10; + if (fuzzy_search.selected_index < 0) { + fuzzy_search.selected_index = 0; + } + return true; + } + case 'l': { + // Page down - move down by 10 items + fuzzy_search.selected_index += 10; + if (fuzzy_search.selected_index >= fuzzy_search.num_results) { + fuzzy_search.selected_index = fuzzy_search.num_results - 1; + } + return true; + } default: { if (ch >= 32 && ch <= 126 && fuzzy_search.query_len < 255) { fuzzy_search.query[fuzzy_search.query_len++] = (char)ch; @@ -483,8 +502,8 @@ static void draw_rack_view(void) { // Draw controls help mvprintw(y + 1, 0, "=== Controls ==="); - mvprintw(y + 2, 0, "h/l - Previous/Next channel"); - mvprintw(y + 3, 0, "j/k - Navigate plugins"); + mvprintw(y + 2, 0, "h/l - Previous/Next channel (or page in fuzzy search)"); + mvprintw(y + 3, 0, "j/k - Navigate plugins (or items in fuzzy search)"); mvprintw(y + 4, 0, "a - Add plugin to rack"); mvprintw(y + 5, 0, "d - Remove selected plugin"); mvprintw(y + 6, 0, "b - Toggle bypass"); @@ -738,6 +757,7 @@ static void draw_grid(void) { mvprintw(GRID_ROWS * CELL_HEIGHT + 17, 0, "z - Toggle grid selector (zoom mode)"); mvprintw(GRID_ROWS * CELL_HEIGHT + 18, 0, "? - Toggle help"); mvprintw(GRID_ROWS * CELL_HEIGHT + 19, 0, "Esc/q - Quit"); + mvprintw(GRID_ROWS * CELL_HEIGHT + 20, 0, "In fuzzy search: j/k navigate, h/l page, Enter select, Esc cancel"); attroff(COLOR_PAIR(COLOR_HELP)); }