From 6b1de2df4fcde8532200c86e483eb578677549dd Mon Sep 17 00:00:00 2001 From: Hojun-Cho Date: Sun, 16 Aug 2026 21:36:31 +0900 Subject: [PATCH] popup: flip above the pointer at the bottom edge Without a caret the popup sat at pointer+10 and was clamped upward at the bottom of the work area, covering the pointer; it now goes above the pointer like it goes above a caret. --- popup_layout.c | 2 ++ tests/popup_test.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/popup_layout.c b/popup_layout.c index 4849c1a..c349dfa 100644 --- a/popup_layout.c +++ b/popup_layout.c @@ -259,6 +259,8 @@ popupposition(Caret *caret, int pointerx, int pointery, Area *area, }else{ px = (vlong)pointerx + 10; py = (vlong)pointery + 10; + if(py + h > bottom) + py = (vlong)pointery - 10 - h; } xmax = max(right - w, area->x); ymax = max(bottom - h, area->y); diff --git a/tests/popup_test.c b/tests/popup_test.c index 1f3fc4e..b83b27a 100644 --- a/tests/popup_test.c +++ b/tests/popup_test.c @@ -108,6 +108,8 @@ popup_layout(struct ct *t) popupposition(&caret, 2000, 50, &area, 100, 60, &x, &y); CT_EQ_INT(t, 2010, x); CT_EQ_INT(t, 60, y); + popupposition(&caret, 2000, 900, &area, 100, 60, &x, &y); + CT_EQ_INT(t, 830, y); /* above the pointer, not over it */ caret.valid = 1; caret.x = 2100; caret.y = 80;