diff --git a/main.c b/main.c index 15f6f34..419d733 100644 --- a/main.c +++ b/main.c @@ -99,7 +99,12 @@ void updateBlock(int i) { int j = bytesRead - 1; while ((buffer[j] & 0b11000000) == 0x80) j--; - buffer[j] = '\0'; + buffer[j] = ' '; + + // Trim trailing spaces + while (buffer[j] == ' ') + j--; + buffer[j + 1] = '\0'; if (bytesRead == LEN(buffer)) { // Clear the pipe