diff options
author | pommicket <pommicket@gmail.com> | 2022-12-22 22:36:27 -0500 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2022-12-22 22:36:27 -0500 |
commit | 266af5ed551765ca22cb90819f570ff9371e279b (patch) | |
tree | b7933241354696fc11a9997b488973614f5f4df1 /autocomplete.c | |
parent | ed6661d4b0bd10d15796a3053da00eddace1f881 (diff) |
even better-looking autocomplete
Diffstat (limited to 'autocomplete.c')
-rw-r--r-- | autocomplete.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/autocomplete.c b/autocomplete.c index 930cd90..db7a045 100644 --- a/autocomplete.c +++ b/autocomplete.c @@ -231,7 +231,7 @@ static void autocomplete_frame(Ted *ted) { break; } - float menu_width = 400, menu_height = (float)ncompletions * char_height + 2 * padding; + float menu_width = 400, menu_height = (float)ncompletions * char_height; if (ac->waiting_for_lsp) { menu_height = 200.f; @@ -256,8 +256,8 @@ static void autocomplete_frame(Ted *ted) { start_y += char_height; // put menu below cursor { Rect menu_rect = rect(V2(x, start_y), V2(menu_width, menu_height)); - gl_geometry_rect(menu_rect, colors[COLOR_MENU_BG]); - //gl_geometry_rect_border(menu_rect, 1, colors[COLOR_BORDER]); + gl_geometry_rect(menu_rect, colors[COLOR_AUTOCOMPLETE_BG]); + gl_geometry_rect_border(menu_rect, 1, colors[COLOR_AUTOCOMPLETE_BORDER]); ac->rect = menu_rect; } @@ -300,11 +300,16 @@ static void autocomplete_frame(Ted *ted) { for (size_t i = 0; i < ncompletions; ++i) { state.x = x; state.y = y; - gl_geometry_rect(rect(V2(x, y + char_height), - V2(menu_width, border_thickness)), - colors[COLOR_AUTOCOMPLETE_BORDER]); + if (i != ncompletions-1) { + gl_geometry_rect(rect(V2(x, y + char_height), + V2(menu_width, border_thickness)), + colors[COLOR_AUTOCOMPLETE_BORDER]); + } ColorSetting label_color = color_for_symbol_kind(completions[i].kind); + if (!settings->syntax_highlighting) + label_color = COLOR_TEXT; + rgba_u32_to_floats(colors[label_color], state.color); // draw icon |