summaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2021-03-03 20:14:51 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2021-03-03 20:14:51 -0500
commit6ef4720bba8fcb90bcbdca5d7766b76816fc58c5 (patch)
tree41a0d02884f182193ff41ccb23b7f66adf35404b /buffer.c
parente3eb333ae2b07467e14dd9e2f845889f75f01a16 (diff)
more autocomplete (already partially working!)
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/buffer.c b/buffer.c
index 7c5c9db..51bdfbe 100644
--- a/buffer.c
+++ b/buffer.c
@@ -2148,6 +2148,12 @@ u32 buffer_last_rendered_line(TextBuffer *buffer) {
// returns true if the buffer "used" this event
bool buffer_handle_click(Ted *ted, TextBuffer *buffer, v2 click, u8 times) {
BufferPos buffer_pos;
+ if (ted->autocomplete) {
+ if (rect_contains_point(ted->autocomplete_rect, click))
+ return false; // don't look at clicks in the autocomplete menu
+ else
+ ted->autocomplete = false; // close autocomplete menu if user clicks outside of it
+ }
if (buffer_pixels_to_pos(buffer, click, &buffer_pos)) {
// user clicked on buffer
if (!ted->menu || buffer->is_line_buffer) {