Fix some things

Prevent `ESC LF` from performing the newline.
Only recognise `, ~`, not `,` anything.
Document BEL and the ignored sequences.
This commit is contained in:
Jason Hood 2017-11-30 11:38:15 +10:00
parent 1754f68ac9
commit 523c478d67
4 changed files with 18 additions and 8 deletions

8
ANSI.c
View File

@ -152,7 +152,7 @@
remove wcstok, avoiding potential interference with the host;
similarly, use a private heap instead of malloc.
v1.80, 26 October to 29 November, 2017:
v1.80, 26 October to 30 November, 2017:
fix unloading;
revert back to (re)storing buffer cursor position;
increase cache to five handles;
@ -1482,7 +1482,7 @@ ParseAndPrintString( HANDLE hDev,
{
FlushBuffer();
pState->crm = TRUE;
PushBuffer( (WCHAR)c );
ChBuffer[nCharInBuffer++] = c; // skip newline handling
FlushBuffer();
pState->crm = FALSE;
state = 1;
@ -1543,7 +1543,7 @@ ParseAndPrintString( HANDLE hDev,
{
suffix2 = c;
}
else if (suffix2 != 0 && suffix2 != ',' && suffix2 != '+')
else if (suffix2 != 0 && suffix2 != '+' && (suffix2 != ',' || c != '~'))
{
state = 1;
}
@ -1576,7 +1576,7 @@ ParseAndPrintString( HANDLE hDev,
{
suffix2 = c;
}
else if (suffix2 != 0 && suffix2 != ',' && suffix2 != '+')
else if (suffix2 != 0 && suffix2 != '+' && (suffix2 != ',' || c != '~'))
{
state = 1;
}

View File

@ -90,7 +90,7 @@
write newline with _putws, not putwchar (fixes redirecting to CON).
*/
#define PDATE L"29 November, 2017"
#define PDATE L"30 November, 2017"
#include "ansicon.h"
#include "version.h"

View File

@ -157,6 +157,7 @@ Sequences Recognised
\e[21t xterm: Report window's title
\e[s ANSI.SYS: Save Cursor Position
\e[u ANSI.SYS: Restore Cursor Position
BEL BEL Bell
\e[#Z CBT Cursor Backward Tabulation
\e[#G CHA Cursor Character Absolute
\e[#I CHT Cursor Forward Tabulation
@ -301,7 +302,7 @@ Version History
Legend: + added, - bug-fixed, * changed.
1.80 - 29 November, 2017:
1.80 - 30 November, 2017:
- fix unloading;
- fix -e et al when redirecting to CON;
- hook CreateFile and CreateConsoleScreenBuffer to force read/write access
@ -544,4 +545,4 @@ Distribution
=============================
Jason Hood, 29 November, 2017.
Jason Hood, 30 November, 2017.

View File

@ -6,7 +6,8 @@ This is a complete list of the ANSI escape sequences recognised by ANSICON,
roughly ordered by function. The initial escape character is assumed. The
display consists of the buffer width and window height; add '+' before the
final character to use the buffer height (e.g. "[2J" will erase the window,
whilst "[2+J" will erase the buffer).
whilst "[2+J" will erase the buffer). BEL will also be recognised, playing
the Windows default beep (but only if it's not already playing).
[m restore default color (and intensity)
@ -160,3 +161,11 @@ whilst "[2+J" will erase the buffer).
6 F5 698 15 D6 1174 24 B6 1976
7 F#5/Gb5 740 16 D#6/Eb6 1244 25 C7 2094
8 G5 784 17 E6 1318
P...ST ignored (Device Control String)
X...ST ignored (Start Of String)
^...ST ignored (Privacy Message)
_...ST ignored (Application Program Command)
Any of space and !"#$%&'()*+,-./, possibly repeated, followed by anything else,
will be ignored.