diff --git a/ANSI.c b/ANSI.c index 49c88f2..4233e4c 100644 --- a/ANSI.c +++ b/ANSI.c @@ -152,12 +152,14 @@ remove wcstok, avoiding potential interference with the host; similarly, use a private heap instead of malloc. - v1.80, 26 October to 3 November, 2017: + v1.80, 26 October to 7 November, 2017: fix unloading; revert back to (re)storing buffer cursor position; increase cache to five handles; hook CreateFile & CreateConsoleScreenBuffer to enable readable handles; - fix cursor report with duplicated digits (e.g. "11" was just "1"). + fix cursor report with duplicated digits (e.g. "11" was just "1"); + preserve escape that isn't part of a sequence; + fix escape followed by CRM in control mode. */ #include "ansicon.h" @@ -1202,7 +1204,8 @@ ParseAndPrintString( HANDLE hDev, } else if (state == 2) { - if (c == ESC) ; // \e\e...\e == \e + if (c == ESC) + PushBuffer( ESC ); else if (c >= '\x20' && c <= '\x2f') suffix2 = c; else if (suffix2 != 0) @@ -1225,7 +1228,12 @@ ParseAndPrintString( HANDLE hDev, *Pt_arg = '\0'; state = 6; } - else state = 1; + else + { + PushBuffer( ESC ); + PushBuffer( (WCHAR)c ); + state = 1; + } } else if (state == 3) { @@ -1329,8 +1337,11 @@ ParseAndPrintString( HANDLE hDev, else { PushBuffer( ESC ); - PushBuffer( (WCHAR)c ); - state = 1; + if (c != ESC) + { + PushBuffer( (WCHAR)c ); + state = 1; + } } } else if (state == 8) diff --git a/ansicon.c b/ansicon.c index 8df047f..45a3ebf 100644 --- a/ansicon.c +++ b/ansicon.c @@ -90,7 +90,7 @@ write newline with _putws, not putwchar (fixes redirecting to CON). */ -#define PDATE L"3 November, 2017" +#define PDATE L"7 November, 2017" #include "ansicon.h" #include "version.h" diff --git a/readme.txt b/readme.txt index a87a09d..6e880a3 100644 --- a/readme.txt +++ b/readme.txt @@ -295,13 +295,15 @@ Version History Legend: + added, - bug-fixed, * changed. - 1.80 - 3 November, 2017: + 1.80 - 7 November, 2017: - fix unloading; - fix -e et al when redirecting to CON; - hook CreateFile and CreateConsoleScreenBuffer to force read/write access (fixes redirecting to CON and Microsoft's conio); - fix cursor report with duplicated digits (e.g. "11" was only writing "1"); - * go back to saving the buffer cursor position. + - fix escape followed by CRM in control mode; + * go back to saving the buffer cursor position; + * preserve escape that isn't part of a sequence. 1.72 - 24 December, 2015: - handle STD_OUTPUT_HANDLE & STD_ERROR_HANDLE in WriteFile; @@ -530,4 +532,4 @@ Distribution ============================= -Jason Hood, 3 November, 2017. +Jason Hood, 7 November, 2017.