diff --git a/stage23/lib/readline.c b/stage23/lib/readline.c index 28673ab3..f13347b7 100644 --- a/stage23/lib/readline.c +++ b/stage23/lib/readline.c @@ -272,7 +272,6 @@ void readline(const char *orig_str, char *buf, size_t limit) { term_autoflush = false; size_t orig_str_len = strlen(orig_str); - memset(buf, 0, limit); memmove(buf, orig_str, orig_str_len); buf[orig_str_len] = 0; @@ -303,6 +302,9 @@ void readline(const char *orig_str, char *buf, size_t limit) { cursor_back(); case GETCHAR_DELETE:; size_t j; + if (buf[i] == 0) { + continue; + } for (j = i; ; j++) { buf[j] = buf[j+1]; if (!buf[j]) {