feat: add 'L' shortcut to load sample via fuzzy search

Co-authored-by: aider (deepseek/deepseek-coder) <aider@aider.chat>
This commit is contained in:
Loic Coenen
2026-05-03 11:31:20 +00:00
parent b6a106a86b
commit 7ffcd67436

18
tui.c
View File

@@ -892,6 +892,7 @@ static void draw_grid(void) {
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");
mvprintw(GRID_ROWS * CELL_HEIGHT + 21, 0, "L - Load sample into selected clip (fuzzy search)");
attroff(COLOR_PAIR(COLOR_HELP));
}
@@ -1334,6 +1335,23 @@ void tui_run(Engine *engine) {
zoom_mode = !zoom_mode;
break;
}
case 'L': {
// Start fuzzy search for WAV files
const char *samples_dir = getenv("JACK_LOOPER_SAMPLES_DIR");
if (!samples_dir) samples_dir = ".";
int count;
const char **files = list_wav_files(samples_dir, &count);
if (files && count > 0) {
start_fuzzy_search_items("Load sample:", load_sample_callback,
files, count, true);
} else {
// No files found, show message
mvprintw(LINES - 1, 0, "No WAV files found in %s", samples_dir);
refresh();
napms(1500);
}
break;
}
case '?':
show_help = !show_help;
break;