wl: counting bytes needs no buffer to put them in
backbytes copied the runes into a Str and encoded them into a 257-byte stack buffer only to throw the bytes away and keep the length. runelen answers over the same runes with neither. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
10
wl.c
10
wl.c
@@ -127,14 +127,12 @@ sendrequest(int op, u32int ks, u32int mod, Keyres *res)
|
||||
static int
|
||||
backbytes(int n)
|
||||
{
|
||||
char utf[Maxutf];
|
||||
Str s;
|
||||
int i;
|
||||
int i, nb;
|
||||
|
||||
sclear(&s);
|
||||
nb = 0;
|
||||
for(i = max(surround.n - n, 0); i < surround.n; i++)
|
||||
sputr(&s, surround.r[i]);
|
||||
return stoutf(&s, utf, sizeof utf);
|
||||
nb += runelen(surround.r[i]);
|
||||
return nb;
|
||||
}
|
||||
|
||||
/* The engine's modifier bits, read from the grab's own keyboard state. */
|
||||
|
||||
Reference in New Issue
Block a user