From 234051d6bca28d8379cf19633ded47ba1a165c09 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Mon, 3 Jun 2024 18:03:19 +0300 Subject: [PATCH] Shell: Optimize drawing characters at the end of a command --- userspace/Shell/main.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/userspace/Shell/main.cpp b/userspace/Shell/main.cpp index feebfe41..4fc75031 100644 --- a/userspace/Shell/main.cpp +++ b/userspace/Shell/main.cpp @@ -1064,7 +1064,7 @@ int main(int argc, char** argv) buffers[index].clear(); col = 0; break; - case '\x04': + case '\x04': // ^D fprintf(stdout, "\n"); clean_exit(); break; @@ -1086,7 +1086,10 @@ int main(int argc, char** argv) break; default: MUST(buffers[index].insert(ch, col++)); - fprintf(stdout, "%c\e[s%s\e[u", ch, buffers[index].data() + col); + if (col == buffers[index].size()) + fputc(ch, stdout); + else + fprintf(stdout, "%c\e[s%s\e[u", ch, buffers[index].data() + col); fflush(stdout); break; }