summaryrefslogtreecommitdiff
path: root/ide-autocomplete.c
diff options
context:
space:
mode:
Diffstat (limited to 'ide-autocomplete.c')
-rw-r--r--ide-autocomplete.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/ide-autocomplete.c b/ide-autocomplete.c
index b8898d5..ee0ebf3 100644
--- a/ide-autocomplete.c
+++ b/ide-autocomplete.c
@@ -608,11 +608,10 @@ void autocomplete_frame(Ted *ted) {
}
}
-
- for (uint i = 0; i < ted->nmouse_clicks[SDL_BUTTON_LEFT]; ++i) {
- vec2 click = ted->mouse_clicks[SDL_BUTTON_LEFT][i];
- if (rect_contains_point(ac->rect, click)) {
- i32 entry = scroll + (i32)((click.y - start_y) / char_height);
+ arr_foreach_ptr(ted->mouse_clicks[SDL_BUTTON_LEFT], MouseClick, click) {
+ vec2 pos = click->pos;
+ if (rect_contains_point(ac->rect, pos)) {
+ i32 entry = scroll + (i32)((pos.y - start_y) / char_height);
if (entry >= 0 && entry < (i32)ncompletions) {
// entry was clicked on! use this completion.
autocomplete_complete(ted, ac->completions[ac->suggested[entry]]);