summaryrefslogtreecommitdiff
path: root/ide-hover.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 /ide-hover.c
parent056ccc31cc2cfc1037a47a0b6ae35d0033602cbf (diff)
fixed hover bug
Diffstat (limited to 'ide-hover.c')
-rw-r--r--ide-hover.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/ide-hover.c b/ide-hover.c
index 9742e58..5136d79 100644
--- a/ide-hover.c
+++ b/ide-hover.c
@@ -8,20 +8,16 @@ void hover_close(Ted *ted) {
}
static bool get_hover_position(Ted *ted, LSPDocumentPosition *pos, TextBuffer **pbuffer, LSP **lsp) {
- // find the buffer where the mouse is
- for (int i = 0; i < TED_MAX_BUFFERS; ++i) {
- TextBuffer *buffer = &ted->buffers[i];
- if (!buffer->filename) continue;
+ BufferPos mouse_pos = {0};
+ TextBuffer *buffer = NULL;
+ if (ted_get_mouse_buffer_pos(ted, &buffer, &mouse_pos)) {
LSP *l = buffer_lsp(buffer);
- if (!l) continue;
- BufferPos mouse_pos = {0};
- if (buffer_pixels_to_pos(buffer, ted->mouse_pos, &mouse_pos)) {
- if (pos) *pos = buffer_pos_to_lsp_document_position(buffer, mouse_pos);
- if (pbuffer) *pbuffer = buffer;
- if (lsp) *lsp = l;
- return true;
- }
+ if (pos) *pos = buffer_pos_to_lsp_document_position(buffer, mouse_pos);
+ if (pbuffer) *pbuffer = buffer;
+ if (lsp) *lsp = l;
+ return true;
}
+
return false;
}