Add partial SCS support

Allow G0 to be set to the DEC Special Graphics Character Set or ASCII.
This commit is contained in:
Jason Hood 2017-12-09 21:01:13 +10:00
parent 0e87a03761
commit c11447fc8b
3 changed files with 26 additions and 23 deletions

15
ANSI.c
View File

@ -211,7 +211,7 @@ int es_argc; // escape sequence args count
int es_argv[MAX_ARG]; // escape sequence args
TCHAR Pt_arg[MAX_PATH*2]; // text parameter for Operating System Command
int Pt_len;
BOOL shifted;
BOOL shifted, G0_special;
int screen_top = -1; // initial window top when cleared
@ -1573,7 +1573,7 @@ ParseAndPrintString( HANDLE hDev,
{
hConOut = hDev;
state = 1;
shifted = FALSE;
shifted = G0_special = FALSE;
}
for (i = nNumberOfBytesToWrite, s = (LPCTSTR)lpBuffer; i > 0; i--, s++)
{
@ -1594,7 +1594,7 @@ ParseAndPrintString( HANDLE hDev,
hBell = CreateThread( NULL, 4096, BellThread, NULL, 0, NULL );
}
else if (c == SO) shifted = TRUE;
else if (c == SI) shifted = FALSE;
else if (c == SI) shifted = G0_special;
else PushBuffer( (WCHAR)c );
}
else if (state == 2)
@ -1611,7 +1611,16 @@ ParseAndPrintString( HANDLE hDev,
else if (c >= '\x20' && c <= '\x2f')
suffix2 = c;
else if (suffix2 != 0)
{
if (suffix2 == '(') // Designate G0 character set
{
if (c == '0')
shifted = G0_special = TRUE;
else if (c == 'B')
shifted = G0_special = FALSE;
}
state = 1;
}
else if (c == 'E') // NEL Next Line
{
PushBuffer( '\n' );

View File

@ -202,6 +202,8 @@ Sequences Recognised
\eE NEL Next Line
\e[#b REP Repeat
\eM RI Reverse Index
\e(0 SCS Select Character Set (DEC special graphics)
\e(B SCS Select Character Set (ASCII)
\e[#;#;#m SGR Select Graphic Rendition
\e[#d VPA Line Position Absolute
\e[#k VPB Line Position Backward
@ -209,12 +211,14 @@ Sequences Recognised
'\e' represents the escape character (ASCII 27); '#' represents a decimal
number (optional, in most cases defaulting to 1); BEL, SO and SI are ASCII
7, 14 and 15. Regarding SGR: bold will set the foreground intensity; blink
and underline will set the background intensity; conceal uses background as
foreground. See "sequences.txt" for a more complete description.
7, 14 and 15. See "sequences.txt" for a more complete description.
Escape followed by a control character will display that character, not
perform its function. An unrecognised sequence will preserve the escape.
perform its function; an unrecognised character will preserve the escape.
SO will select the G1 character set; SI will select the G0 set. The G0
character set is set by SCS; the G1 character set is always the DEC
Special Graphics Character Set.
I make a distinction between '\e[m' and '\e[0;...m'. Both will restore the
original foreground/background colors (and so '0' should be the first para-
@ -230,20 +234,6 @@ Sequences Recognised
scroll in a new window.
Sequences Ignored
=================
The following escape sequences are explicitly ignored.
\e(? Designate G0 character set ('?' is any character).
\e)? Designate G1 character set ('?' is any character).
\e[?... Private sequence
\e[>... Private sequence
The G0 character set is always ASCII; the G1 character set is always the
DEC Special Graphics Character Set.
DEC Special Graphics Character Set
==================================
@ -253,7 +243,7 @@ DEC Special Graphics Character Set
Char Unicode Code Point & Name
---- -------------------------
_ U+00A0 No-Break Space (blank)
_ U+00A0 No-Break Space
` U+2666 Black Diamond Suit
a U+2592 Medium Shade
b U+2409 Symbol For Horizontal Tabulation
@ -330,7 +320,8 @@ Version History
+ added '+' intermediate byte to use the buffer, rather than the window;
+ added palette sequences;
+ added -pu to unload from the parent;
+ added IND, NEL, RI, DA, DECCOLM, DECNCSM, DECSC & DECRC.
+ added IND, NEL, RI, DA, DECCOLM, DECNCSM, DECSC & DECRC;
+ added SCS, but only for special/ASCII (same as Win10).
1.72 - 24 December, 2015:
- handle STD_OUTPUT_HANDLE & STD_ERROR_HANDLE in WriteFile;

View File

@ -124,6 +124,9 @@ M move cursor up one line (scroll if necessary; always uses buffer)
[u move cursor to saved position (or top-left, if nothing was saved)
8 as above
(0 select the DEC Special Graphics Character Set
(B select ASCII
[3h display control characters (LF is also performed)
[3l perform control functions (the only such recognised during above)
[?3h set 132 columns