ansicon
ansicon copied to clipboard
Newline at end of line causes blank line, only in rare cases
Newline at end of line causes an unwanted blank line, but only in rare cases.
Ansicon version: 1.89
OS: ReactOS 0.4.14 (NT 5.2, 32-bit)
I don't know if this happens on real Windows.
The test program must be run MANY (13) times before the issue manifests itself. Maybe something with the scroll buffer? It doesn't seem to matter if Ansicon has been installed or not or started from cmd or explorer, the test program just has to be run enough times.
The first two tests do NOT reproduce this issue, only the last two.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
char *buf = malloc(100000);
// 100 kB more than enough for ~2000 chars on a full screen.
int row, column;
// Simpler test does not reproduce the issue
printf("Bulk IO without escape codes:\n");
buf[0] = '\0';
for (row = 0; row < 3; row++) {
for (column = 0; column < 80; column++)
strcat(buf, ".");
strcat(buf, "\n");
}
printf(buf);
// Escape code at EOL?? Also does not reproduce the issue
printf("\n\nEscape code at EOL:\n");
for (row = 0; row < 3; row++) {
for (column = 0; column < 80; column++)
putchar('.');
printf("\x1b[0m\n");
}
// First working test
printf("\n\nBulk IO with escape codes:\n");
buf[0] = '\0';
for (row = 0; row < 3; row++) {
for (column = 0; column < 80; column++)
strcat(buf, "\x1b[37m\x1b[44m.\x1b[0m");
strcat(buf, "\n");
}
printf(buf);
// Repetitive IO
printf("\n\nRepetitive IO with escape codes:\n");
for (row = 0; row < 3; row++) {
for (column = 0; column < 80; column++)
printf("\x1b[37m\x1b[44m.\x1b[0m");
putchar('\n');
}
return 0;
}
The first two tests do NOT reproduce this issue, only the last two.
Wrong result in ansicon (blank lines between the all dots lines):
![]()
Correct result:
![]()
Confirmed with real Windows, but I'm afraid I can't say when I'll look at it.