Use uint8_t for keyboard chars

This commit is contained in:
2025-09-19 21:00:33 +02:00
parent 504bdbd4ba
commit 1af0d1f5bc
3 changed files with 16 additions and 26 deletions

View File

@ -109,11 +109,11 @@ void do_mode_interactive(void) {
cursor = 0;
string_memset(linebuf, 0, LINEBUF_MAX);
int32_t kbchr = 0;
uint8_t b = 0;
for (;;) {
int32_t nrd = ipcpipe(PID, IPCPIPE_IN, IPCPIPE_READ, (uint8_t *)&kbchr, sizeof(kbchr));
int32_t nrd = ipcpipe(PID, IPCPIPE_IN, IPCPIPE_READ, &b, 1);
if (nrd > 0) {
switch (kbchr) {
switch (b) {
case C('C'):
case 0xE9:
uprintf("\n");
@ -126,15 +126,13 @@ void do_mode_interactive(void) {
break;
}
char chr = kbchr & 0xFF;
if (chr == '\n') {
if (b == '\n') {
break;
}
if (string_chr_isascii(chr) && chr != 0 && cursor < LINEBUF_MAX) {
linebuf[cursor++] = chr;
uprintf("%c", chr);
if (string_chr_isascii(b) && b != 0 && cursor < LINEBUF_MAX) {
linebuf[cursor++] = b;
uprintf("%c", b);
}
}
}