diff options
author | pommicket <pommicket@gmail.com> | 2023-01-06 22:04:38 -0500 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2023-01-06 22:04:38 -0500 |
commit | a654b666c20aa4bb42116689f90f83d55484786f (patch) | |
tree | 02b3f0b5019d8fadb8ca9c743cc6085698576e9c /ide-autocomplete.c | |
parent | 42ae808f712efb7edac1bdc647a456cfcccb2d39 (diff) |
fix some autocomplete issues
also untested higher-than-1-second-resolution windows time_last_modified
Diffstat (limited to 'ide-autocomplete.c')
-rw-r--r-- | ide-autocomplete.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/ide-autocomplete.c b/ide-autocomplete.c index 4443c2b..bee99bf 100644 --- a/ide-autocomplete.c +++ b/ide-autocomplete.c @@ -394,11 +394,28 @@ void autocomplete_open(Ted *ted, uint32_t trigger) { static void autocomplete_find_phantom(Ted *ted) { Autocomplete *ac = &ted->autocomplete; - if (ac->open) return; - if (!ted->active_buffer) return; + if (ac->open) { + autocomplete_clear_phantom(ac); + return; + } + if (!ted->active_buffer) { + autocomplete_clear_phantom(ac); + return; + } TextBuffer *buffer = ted->active_buffer; - if (!buffer->path) return; - if (buffer->view_only) return; + if (!buffer->path) { + autocomplete_clear_phantom(ac); + return; + } + if (buffer->view_only) { + autocomplete_clear_phantom(ac); + return; + } + char32_t after_cursor = buffer_char_after_cursor(buffer); + if (is32_word(after_cursor)) { + autocomplete_clear_phantom(ac); + return; + } autocomplete_find_completions(ted, TRIGGER_INVOKED, true); } @@ -450,6 +467,9 @@ void autocomplete_frame(Ted *ted) { colors[COLOR_TEXT] & 0xffffff7f); text_render(font); gl_geometry_draw(); + } else { + // this phantom is no longer relevant + autocomplete_clear_phantom(ac); } } else { // this phantom is no longer relevant |