Add basic modes and mode-navigation

This commit is contained in:
2025-12-13 00:48:42 +00:00
parent dad7d844ca
commit ce06ca8057
4 changed files with 57 additions and 5 deletions

View File

@@ -37,8 +37,8 @@ void enqueue_bytes(const char *bytes, int len) {
}
int read_input(char *&buf) {
size_t cap = 32;
buf = (char *)malloc(cap);
size_t cap = 16;
buf = (char *)calloc(cap, sizeof(char));
size_t len = 0;
char header;
if (!get_next_byte(&header)) {
@@ -199,6 +199,9 @@ KeyEvent read_key() {
ret.key_type = KEY_CHAR;
ret.c = buf;
ret.len = n;
return ret;
}
if (n > 0)
free(buf);
return ret;
}