diff options
author | pommicket <pommicket@gmail.com> | 2023-08-04 20:52:10 -0400 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2023-08-04 20:52:10 -0400 |
commit | ce199f9384f9f9376417110574a07cfd731e3a79 (patch) | |
tree | d87a14a789eea521252447cd6dd477295e5612b9 /ide-autocomplete.c | |
parent | 4cdbd1c8caf7fbd9ed584049312241a0e039e115 (diff) |
use dynamic arrays for mouse_clicks/mouse_releases
simplifies code
Diffstat (limited to 'ide-autocomplete.c')
-rw-r--r-- | ide-autocomplete.c | 9 |
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]]); |