summaryrefslogtreecommitdiff
path: root/ide-signature-help.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-10-15 14:45:12 -0400
committerpommicket <pommicket@gmail.com>2023-10-15 14:45:12 -0400
commit479219152b85b2cf12e5bfee6fdebca033355beb (patch)
treefd436c2c7f7bfa6430c1777c05b32facca7d6c78 /ide-signature-help.c
parent76cd1aa9c674db76e2a95db5a95aa79c5a2ce4ae (diff)
move signature help when cursor is at bottom of screen
this fixes a bug where the cursor would be blocked by the signature help
Diffstat (limited to 'ide-signature-help.c')
-rw-r--r--ide-signature-help.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/ide-signature-help.c b/ide-signature-help.c
index 7bde85c..90853e6 100644
--- a/ide-signature-help.c
+++ b/ide-signature-help.c
@@ -159,9 +159,19 @@ void signature_help_frame(Ted *ted) {
--signature_count;
if (signature_count == 0) return;
}
- float x = buf_rect.pos.x, y = rect_y2(buf_rect) - height;
- gl_geometry_rect(rect_xywh(x, y - border, width, border),
- settings_color(settings, COLOR_AUTOCOMPLETE_BORDER));
+ float x = buf_rect.pos.x, y;
+ vec2 cursor_pos = buffer_pos_to_pixels(buffer, buffer_cursor_pos(buffer));
+ if (cursor_pos.y < rect_ymid(buffer_rect(buffer))) {
+ // signature help on bottom
+ y = rect_y2(buf_rect) - height;
+ gl_geometry_rect(rect_xywh(x, y - border, width, border),
+ settings_color(settings, COLOR_AUTOCOMPLETE_BORDER));
+ } else {
+ // signature help on top
+ y = rect_y1(buf_rect);
+ gl_geometry_rect(rect_xywh(x, y + height + 1 - border, width, border),
+ settings_color(settings, COLOR_AUTOCOMPLETE_BORDER));
+ }
gl_geometry_rect(rect_xywh(x, y, width, height),
settings_color(settings, COLOR_AUTOCOMPLETE_BG));