Work with unix line endings on display ansi

This commit is contained in:
Andrew Pamment 2018-01-15 14:21:53 +10:00
parent dd1d4d4eaa
commit 209c8b932c

View File

@ -296,6 +296,7 @@ void s_displayansi_pause(char *file, int pause) {
char c; char c;
char ch; char ch;
int lines = 0; int lines = 0;
char lastch = 0;
fptr = fopen(file, "r"); fptr = fopen(file, "r");
if (!fptr) { if (!fptr) {
@ -303,8 +304,13 @@ void s_displayansi_pause(char *file, int pause) {
} }
c = fgetc(fptr); c = fgetc(fptr);
while (!feof(fptr) && c != 0x1a) { while (!feof(fptr) && c != 0x1a) {
if (c == '\n' && lastch != '\r') {
s_putchar('\r');
}
s_putchar(c); s_putchar(c);
lastch = c;
if (pause) { if (pause) {
if (c == '\n') { if (c == '\n') {
lines++; lines++;