diff options
author | pommicket <pommicket@gmail.com> | 2022-12-30 15:51:35 -0500 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2022-12-30 15:51:35 -0500 |
commit | ad841a324e905559ab7640956b0fbe2d2fdb3b77 (patch) | |
tree | 105be53e3181a7391e167c26894a7436bea27a23 /ted.c | |
parent | 056ccc31cc2cfc1037a47a0b6ae35d0033602cbf (diff) |
fixed hover bug
Diffstat (limited to 'ted.c')
-rw-r--r-- | ted.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -516,6 +516,24 @@ void ted_press_key(Ted *ted, SDL_Scancode scancode, SDL_Keymod modifier) { } } +bool ted_get_mouse_buffer_pos(Ted *ted, TextBuffer **pbuffer, BufferPos *ppos) { + for (u32 i = 0; i < TED_MAX_NODES; ++i) { + if (ted->nodes_used[i]) { + Node *node = &ted->nodes[i]; + if (node->tabs) { + TextBuffer *buffer = &ted->buffers[node->tabs[node->active_tab]]; + BufferPos pos = {0}; + if (buffer_pixels_to_pos(buffer, ted->mouse_pos, &pos)) { + if (ppos) *ppos = pos; + if (pbuffer) *pbuffer = buffer; + return true; + } + } + } + } + return false; +} + // make the cursor red for a bit to indicate an error (e.g. no autocompletions) void ted_flash_error_cursor(Ted *ted) { ted->cursor_error_time = time_get_seconds(); |