popup: refine the input panel

This commit is contained in:
2026-08-14 20:54:09 +09:00
parent 3576c4ea68
commit f222b4d573
7 changed files with 399 additions and 76 deletions

View File

@@ -179,7 +179,7 @@ font_render(struct ct *t)
static char *plain[] = { "A", "", "", "", "", "𠀋" };
u32int *buf, *mem;
Str a, heart, longrow, missing;
int i, natural, w, x, y;
int i, maxx, maxy, minx, miny, natural, w, x, y;
mem = emalloc((Testn + 2 * Guard) * sizeof mem[0]);
fillpixels(mem, Testn + 2 * Guard, guardcolor);
@@ -231,6 +231,21 @@ font_render(struct ct *t)
}
CT_EQ_INT(t, natural, textwidth(&longrow));
fillpixels(buf, Testn, Colsel);
textdrawfitcolor(buf, Testw, Testh, 2*Fontsz, Fontsz,
2*Fontsz, Colselfg, &longrow);
CT_CHECK(t, (Colselfg & Rgbmask) != (Colsel & Rgbmask));
if(CT_CHECK(t, inkbounds(buf, Colsel,
&minx, &miny, &maxx, &maxy))){
CT_CHECK(t, minx >= 2*Fontsz);
CT_CHECK(t, maxx < 4*Fontsz);
CT_CHECK(t, miny >= Fontsz);
CT_CHECK(t, maxy < 2*Fontsz);
}
checkoutside(t, buf, Colsel, Fontsz);
checkguards(t, mem);
CT_EQ_INT(t, natural, textwidth(&longrow));
missing = mkstr("\xF4\x8F\xBF\xBF");
for(i = 0; i < 32; i++){
textdraw(buf, Testw, Testh, Fontsz, Fontsz, &heart);