feat: add border to fuzzy search dialog

Co-authored-by: aider (deepseek/deepseek-coder) <aider@aider.chat>
This commit is contained in:
Loic Coenen
2026-05-02 22:58:55 +00:00
parent 246f85ce97
commit cf42996967

21
tui.c
View File

@@ -287,20 +287,21 @@ static void draw_fuzzy_search(void) {
int width = COLS / 2;
int height = LINES / 3;
// Draw border
for (int y = start_y - 1; y <= start_y + height; y++) {
for (int x = start_x - 1; x <= start_x + width; x++) {
mvaddch(y, x, ' ');
}
}
// Create a temporary window for the border
WINDOW *win = newwin(height + 2, width + 2, start_y - 1, start_x - 1);
if (!win) return;
wclear(win);
box(win, 0, 0);
wrefresh(win);
delwin(win);
// Draw title
// Draw title (inside the border)
attron(A_BOLD);
mvprintw(start_y - 1, start_x, "%s", fuzzy_search.prompt);
mvprintw(start_y, start_x, "%s", fuzzy_search.prompt);
attroff(A_BOLD);
// Draw search box
mvprintw(start_y, start_x, "> %s", fuzzy_search.query);
mvprintw(start_y + 1, start_x, "> %s", fuzzy_search.query);
// Draw results
for (int i = 0; i < height - 2 && i < fuzzy_search.num_results; i++) {
@@ -311,7 +312,7 @@ static void draw_fuzzy_search(void) {
int count;
const char **plugins = carla_get_available_plugins(NULL, &count);
if (plugins && idx >= 0 && idx < count) {
mvprintw(start_y + 1 + i, start_x, "%s", plugins[idx]);
mvprintw(start_y + 2 + i, start_x, "%s", plugins[idx]);
}
if (i == fuzzy_search.selected_index) {
attroff(A_REVERSE);