1 static void xdrawcmdline (K8Term
*term
, K8TCmdLine
*cmdline
, int scry
) {
3 int cpos
= cmdline
->cmdofs
, bc
= 0, x
, sx
;
4 int back
= (cmdline
->cmdMode
== K8T_CMDMODE_INPUT
? 21 : 124);
5 int rslen
= (cmdline
->cmdMode
== K8T_CMDMODE_INPUT
? cmdline
->cmdreslen
: 32760);
7 base
.attr
= K8T_ATTR_NORMAL
|K8T_ATTR_FGSET
|K8T_ATTR_BGSET
;
12 for (sx
= x
= 0; x
< term
->col
&& cmdline
->cmdline
[cpos
] && cpos
< rslen
; ++x
) {
13 int l
= k8t_UTF8Size(cmdline
->cmdline
+cpos
);
15 if (bc
+l
> K8T_DRAW_BUF_SIZ
) {
16 k8t_drawString(term
, term
->drawbuf
, &base
, sx
, scry
, x
-sx
, bc
);
20 memcpy(term
->drawbuf
+bc
, cmdline
->cmdline
+cpos
, l
);
24 if (bc
> 0) k8t_drawString(term
, term
->drawbuf
, &base
, sx
, scry
, x
-sx
, bc
);
28 for (sx
= x
; x
< term
->col
&& cmdline
->cmdline
[cpos
]; ++x
) {
29 int l
= k8t_UTF8Size(cmdline
->cmdline
+cpos
);
31 if (bc
+l
> K8T_DRAW_BUF_SIZ
) {
32 k8t_drawString(term
, term
->drawbuf
, &base
, sx
, scry
, x
-sx
, bc
);
36 memcpy(term
->drawbuf
+bc
, cmdline
->cmdline
+cpos
, l
);
40 if (bc
> 0) k8t_drawString(term
, term
->drawbuf
, &base
, sx
, scry
, x
-sx
, bc
);
42 if (x
< term
->col
&& cmdline
->cmdMode
== K8T_CMDMODE_INPUT
) {
45 k8t_drawString(term
, " ", &base
, x
, scry
, 1, 1);
52 memset(term
->drawbuf
, ' ', K8T_DRAW_BUF_SIZ
);
53 while (x
< term
->col
) {
55 x
+= K8T_DRAW_BUF_SIZ
;
56 if (x
> term
->col
) x
= term
->col
;
57 k8t_drawString(term
, term
->drawbuf
, &base
, sx
, scry
, x
-sx
, x
-sx
);
61 k8t_drawCopy(term
, 0, scry
, term
->col
, 1);