feat: switch text to UTF-8; add Unicode key events, dead keys & Czech layout; fix numpad navigation; add NumLock support

This commit is contained in:
daniel committed 2026-10-03 10:11:49 +02:00
1 parent 32660ddd1a
commit 2aa6360b3d
101 files changed
+3733 -1639

No files matched your search

+18 -1
View File
@@ -1712,7 +1712,10 @@ static int _stdin_pump(int block) {
for (;;) {
int c = block ? (int)_mtk_syscall0(SYS_GETCHAR)
: (int)_mtk_syscall0(SYS_GETCHAR_NB);
if (c <= 0) {
/* The syscall returns a sign-extended char: bytes >= 0x80 arrive
negative and are real keys, only 0 means "nothing". */
if (c < 0) c &= 0xFF;
if (c == 0) {
if (block) continue;
return 0;
}
@@ -1721,12 +1724,26 @@ static int _stdin_pump(int block) {
if (c == '\b' || c == 127) {
if (_stdin_line_len > 0) {
/* Drop the whole UTF-8 character: its continuation bytes,
then the lead byte. One terminal cell either way. */
while (_stdin_line_len > 1 &&
((unsigned char)_stdin_linebuf[_stdin_line_len - 1] & 0xC0) == 0x80)
_stdin_line_len--;
_stdin_line_len--;
_stdin_echo_char('\b');
}
continue;
}
/* Bytes >= 0x80 are UTF-8: the kernel encodes typed characters, and
piped input is UTF-8 already. They are stored and echoed as-is. */
if (c >= 0x80) {
if (_stdin_line_len + 2 >= sizeof(_stdin_linebuf)) continue;
_stdin_linebuf[_stdin_line_len++] = (char)c;
_stdin_echo_char((char)c);
continue;
}
if (c == '\n') {
_stdin_linebuf[_stdin_line_len++] = (char)c;
_stdin_echo_char((char)c);