From 20c9b01967b04c621ceb064868c7b1ee2d1ac6e5 Mon Sep 17 00:00:00 2001 From: IoIxD Date: Wed, 21 Jan 2026 14:14:38 -0700 Subject: [PATCH] "properly handle running out of space in the buffer (which is now lowered too)" --- src/main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main.c b/src/main.c index c9b4235..d4bce3c 100644 --- a/src/main.c +++ b/src/main.c @@ -11,15 +11,16 @@ MSH_ENTRY_POINT { while (1) { int out; - char *buf = msh_callocate(2048, sizeof(char)); + char *buf = msh_callocate(512, sizeof(char)); int i = 0, n = 0, last = 0; SIZE_TYPE sz = 0, leftoff = 0; msh_print_strings(msh_working_directory(), " %> ", 0); - while ((out = msh_read_input(buf, &sz, 2048)), out != -1) { + while ((out = msh_read_input(buf, &sz, 512)), out != -1) { switch (out) { - /* backspace */ + /* backspace (also do this when we run out of space) */ + case -2: case 0x7F: if (sz > 0) { msh_move_cursor(-1);