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