diff options
author | pommicket <pommicket@gmail.com> | 2023-08-06 10:59:07 -0400 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2023-08-06 10:59:07 -0400 |
commit | 413e8f4ba1c5937de40f6366a88c26f540cbb222 (patch) | |
tree | 2e4240cfd72bdd23c5ee85e5a94e97717af95a45 /ide-definitions.c | |
parent | 5891bf8f920be9cfa40cc03e86c16e6406943c20 (diff) |
new menu system all done
Diffstat (limited to 'ide-definitions.c')
-rw-r--r-- | ide-definitions.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/ide-definitions.c b/ide-definitions.c index c37ae69..ea268e2 100644 --- a/ide-definitions.c +++ b/ide-definitions.c @@ -261,7 +261,7 @@ void definitions_send_request_if_needed(Ted *ted) { defs->last_request_query = query; } -void definitions_selector_open(Ted *ted) { +static void definitions_selector_open(Ted *ted) { Definitions *defs = &ted->definitions; definitions_clear_entries(defs); LSP *lsp = ted->prev_active_buffer @@ -279,15 +279,16 @@ void definitions_selector_open(Ted *ted) { } -void definitions_selector_close(Ted *ted) { +static bool definitions_selector_close(Ted *ted) { Definitions *defs = &ted->definitions; definitions_clear_entries(defs); ted_cancel_lsp_request(ted, &defs->last_request); free(defs->last_request_query); defs->last_request_query = NULL; + return true; } -void definitions_selector_update(Ted *ted) { +static void definitions_selector_update(Ted *ted) { Definitions *defs = &ted->definitions; Selector *sel = &defs->selector; sel->enable_cursor = true; @@ -328,9 +329,21 @@ void definitions_selector_update(Ted *ted) { } } -void definitions_selector_render(Ted *ted, Rect bounds) { +static void definitions_selector_render(Ted *ted) { + Rect bounds = selection_menu_render_bg(ted); Definitions *defs = &ted->definitions; Selector *sel = &defs->selector; sel->bounds = bounds; selector_render(ted, sel); } + +void definitions_init(Ted *ted) { + MenuInfo info = { + .open = definitions_selector_open, + .close = definitions_selector_close, + .render = definitions_selector_render, + .update = definitions_selector_update, + }; + strbuf_cpy(info.name, MENU_GOTO_DEFINITION); + menu_register(ted, &info); +} |