fix candidate popup bounds

This commit is contained in:
2026-08-11 19:34:27 +09:00
parent 7b40ef419f
commit 4bfb659b6d
2 changed files with 14 additions and 5 deletions

6
dat.h
View File

@@ -27,9 +27,9 @@ enum
{ {
Maxclients = 64, Maxclients = 64,
Maxkouho = 32, Maxkouho = 32,
Maxdisp = 8, Maxdisp = 9,
Imgw = 512, Imgw = (Maxrunes + 3) * Fontsz,
Imgh = Maxdisp * Fontsz + 8, Imgh = (Maxdisp + 1) * Fontsz,
Colfg = 0x000000, Colfg = 0x000000,
Colbg = 0xffffff, Colbg = 0xffffff,

13
win.c
View File

@@ -78,17 +78,26 @@ drawstr(u32int *buf, int x, int y, Rune *r, int n, int maxw, int maxh)
} }
} }
static void
fill(u32int *buf, int n, u32int color)
{
int i;
for(i = 0; i < n; i++)
buf[i] = color;
}
static void static void
drawkouho(Drawcmd *dc, int first, int n, int w, int h) drawkouho(Drawcmd *dc, int first, int n, int w, int h)
{ {
int sely, y, i; int sely, y, i;
Str *s; Str *s;
memset(img, (uchar)Colbg, w * h * sizeof(u32int)); fill(img, w * h, Colbg);
drawstr(img, 0, 0, dc->pre.r, dc->pre.n, w, h); drawstr(img, 0, 0, dc->pre.r, dc->pre.n, w, h);
if(dc->sel >= 0){ if(dc->sel >= 0){
sely = Fontsz + dc->sel * Fontsz; sely = Fontsz + dc->sel * Fontsz;
memset(img + sely * w, (uchar)Colsel, Fontsz * w * sizeof(u32int)); fill(img + sely * w, Fontsz * w, Colsel);
} }
for(i = 0, y = Fontsz; i < n; i++, y += Fontsz){ for(i = 0, y = Fontsz; i < n; i++, y += Fontsz){
s = &dc->kouho[first+i]; s = &dc->kouho[first+i];