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.
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user