popup: show the candidate page

This commit is contained in:
2026-08-14 20:06:53 +09:00
parent 193ed009bd
commit e4fc327ffd
9 changed files with 110 additions and 7 deletions

View File

@@ -4,8 +4,33 @@
void
popup_layout(struct ct *t)
{
static const struct {
int first;
int shown;
int total;
char *want;
} markers[] = {
{ 0, 0, 0, "" },
{ 0, 9, 9, "" },
{ 0, 9, 10, "1-9/10" },
{ 9, 1, 10, "10-10/10" },
{ 0, 9, 18, "1-9/18" },
{ 9, 9, 18, "10-18/18" },
{ 9, 9, 32, "10-18/32" },
{ 18, 9, 32, "19-27/32" },
{ 27, 5, 32, "28-32/32" },
};
char buf[32];
Caret caret;
int x, y;
int i, n, x, y;
for(i = 0; i < nelem(markers); i++){
n = pagemarker(buf, sizeof buf, markers[i].first,
markers[i].shown, markers[i].total);
CT_EQ_INT(t, strlen(markers[i].want), n);
CT_CHECK(t, strcmp(markers[i].want, buf) == 0);
}
CT_EQ_INT(t, (1 + Maxdisp + 1) * Fontsz, Imgh);
memset(&caret, 0, sizeof caret);
popupposition(&caret, 40, 50, 800, 600, 100, 60, &x, &y);