Shell: Optimize drawing characters at the end of a command

This commit is contained in:
Bananymous 2024-06-03 18:03:19 +03:00
parent 981c0eb8bc
commit 234051d6bc
1 changed files with 5 additions and 2 deletions

View File

@ -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;
}