summaryrefslogtreecommitdiff
path: root/ted.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-12-30 15:51:35 -0500
committerpommicket <pommicket@gmail.com>2022-12-30 15:51:35 -0500
commitad841a324e905559ab7640956b0fbe2d2fdb3b77 (patch)
tree105be53e3181a7391e167c26894a7436bea27a23 /ted.c
parent056ccc31cc2cfc1037a47a0b6ae35d0033602cbf (diff)
fixed hover bug
Diffstat (limited to 'ted.c')
-rw-r--r--ted.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/ted.c b/ted.c
index 7e14d0a..831242d 100644
--- a/ted.c
+++ b/ted.c
@@ -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();