diff options
author | pommicket <pommicket@gmail.com> | 2022-12-20 21:54:52 -0500 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2022-12-20 21:54:52 -0500 |
commit | 7568add9317f2bad5f633e5c587c76b87175899f (patch) | |
tree | f758573c4f3fdd6ecb7ebde4fb17314b51ad3b2f /ted.h | |
parent | 885df8890e537383df71f8f828444d6c5cce0243 (diff) |
autocomplete very broken but kinda working
Diffstat (limited to 'ted.h')
-rw-r--r-- | ted.h | 18 |
1 files changed, 11 insertions, 7 deletions
@@ -353,12 +353,21 @@ typedef struct { } BuildError; typedef struct { - bool visible; // updated every frame depending on word at cursor + filter char *label; char *filter; char *text; } Autocompletion; +typedef struct { + bool open; // is the autocomplete window open? + + Autocompletion *completions; // dynamic array of all completions + u32 *suggested; // dynamic array of completions to be suggested (indices into completions) + BufferPos last_pos; // position of cursor last time completions were generated. if this changes, we need to recompute completions. + i32 cursor; // which completion is currently selected (index into suggested) + Rect rect; // rectangle where the autocomplete menu is (needed to avoid interpreting autocomplete clicks as other clicks) +} Autocomplete; + typedef struct Ted { struct LSP *test_lsp; // @TODO: something better @@ -410,12 +419,7 @@ typedef struct Ted { Command warn_unsaved; // if non-zero, the user is trying to execute this command, but there are unsaved changes bool build_shown; // are we showing the build output? bool building; // is the build process running? - bool autocomplete; // is the autocomplete window open? - - Autocompletion *autocompletions; // dynamic array of suggestions - BufferPos autocomplete_pos; // position of cursor last time completions were generated. if this changes, we need to recompute completions. - i32 autocomplete_cursor; // which completion is currently selected - Rect autocomplete_rect; // rectangle where the autocomplete menu is (needed to avoid interpreting autocomplete clicks as other clicks) + Autocomplete autocomplete; FILE *log; |