popup: place and bound the input panel

This commit is contained in:
2026-08-14 20:00:36 +09:00
parent 7619d2bd9d
commit 193ed009bd
6 changed files with 97 additions and 10 deletions

View File

@@ -5,11 +5,15 @@ void
popupposition(Caret *caret, int pointerx, int pointery, int screenw,
int screenh, int w, int h, int *x, int *y)
{
vlong px, py, xmax, ymax;
vlong below, px, py, xmax, ymax;
if(caret->valid){
px = caret->x;
py = (vlong)caret->y + max(caret->h, 0);
below = (vlong)caret->y + max(caret->h, 0);
if(below >= 0 && below + h <= screenh)
py = below;
else
py = (vlong)caret->y - h;
}else{
px = (vlong)pointerx + 10;
py = (vlong)pointery + 10;