Added DECTCEM to show/hide the cursor.
This commit is contained in:
parent
ad82e4e642
commit
b6e61429d7
28
ANSI.c
28
ANSI.c
@ -63,10 +63,11 @@
|
|||||||
ignore sequences starting with \e[? & \e[>;
|
ignore sequences starting with \e[? & \e[>;
|
||||||
close the handles opened by CreateProcess.
|
close the handles opened by CreateProcess.
|
||||||
|
|
||||||
25 & 26 February, 2011:
|
v1.40, 25 & 26 February, 1 March, 2011:
|
||||||
hook GetProcAddress, addresses issues with .NET (work with PowerShell);
|
hook GetProcAddress, addresses issues with .NET (work with PowerShell);
|
||||||
implement SO & SI to use the DEC Special Graphics Character Set (enables
|
implement SO & SI to use the DEC Special Graphics Character Set (enables
|
||||||
line drawing via ASCII); ignore \e(X & \e)X (where X is any character).
|
line drawing via ASCII); ignore \e(X & \e)X (where X is any character);
|
||||||
|
add \e[?25h & \e[?25l to show/hide the cursor (DECTCEM).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ansicon.h"
|
#include "ansicon.h"
|
||||||
@ -478,17 +479,28 @@ void InterpretEscSeq( void )
|
|||||||
int i;
|
int i;
|
||||||
WORD attribut;
|
WORD attribut;
|
||||||
CONSOLE_SCREEN_BUFFER_INFO Info;
|
CONSOLE_SCREEN_BUFFER_INFO Info;
|
||||||
|
CONSOLE_CURSOR_INFO CursInfo;
|
||||||
DWORD len, NumberOfCharsWritten;
|
DWORD len, NumberOfCharsWritten;
|
||||||
COORD Pos;
|
COORD Pos;
|
||||||
SMALL_RECT Rect;
|
SMALL_RECT Rect;
|
||||||
CHAR_INFO CharInfo;
|
CHAR_INFO CharInfo;
|
||||||
|
|
||||||
// Just ignore \e[? & \e[> sequences.
|
|
||||||
if (prefix2 != 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (prefix == '[')
|
if (prefix == '[')
|
||||||
{
|
{
|
||||||
|
if (prefix2 == '?' && (suffix == 'h' || suffix == 'l'))
|
||||||
|
{
|
||||||
|
if (es_argc == 1 && es_argv[0] == 25)
|
||||||
|
{
|
||||||
|
GetConsoleCursorInfo( hConOut, &CursInfo );
|
||||||
|
CursInfo.bVisible = (suffix == 'h');
|
||||||
|
SetConsoleCursorInfo( hConOut, &CursInfo );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Ignore any other \e[? or \e[> sequences.
|
||||||
|
if (prefix2 != 0)
|
||||||
|
return;
|
||||||
|
|
||||||
GetConsoleScreenBufferInfo( hConOut, &Info );
|
GetConsoleScreenBufferInfo( hConOut, &Info );
|
||||||
switch (suffix)
|
switch (suffix)
|
||||||
{
|
{
|
||||||
@ -828,6 +840,10 @@ void InterpretEscSeq( void )
|
|||||||
}
|
}
|
||||||
else // (prefix == ']')
|
else // (prefix == ']')
|
||||||
{
|
{
|
||||||
|
// Ignore any \e]? or \e]> sequences.
|
||||||
|
if (prefix2 != 0)
|
||||||
|
return;
|
||||||
|
|
||||||
if (es_argc == 1 && es_argv[0] == 0) // ESC]0;titleST
|
if (es_argc == 1 && es_argv[0] == 0) // ESC]0;titleST
|
||||||
{
|
{
|
||||||
SetConsoleTitle( Pt_arg );
|
SetConsoleTitle( Pt_arg );
|
||||||
|
@ -49,8 +49,8 @@
|
|||||||
-i implies -p.
|
-i implies -p.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PVERS L"1.32"
|
#define PVERS L"1.40"
|
||||||
#define PDATE L"22 December, 2010"
|
#define PDATE L"1 March, 2011"
|
||||||
|
|
||||||
#include "ansicon.h"
|
#include "ansicon.h"
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
|
@ -28,7 +28,7 @@ void InjectDLL64( LPPROCESS_INFORMATION, LPCTSTR );
|
|||||||
// ========== Auxiliary debug function
|
// ========== Auxiliary debug function
|
||||||
|
|
||||||
#ifndef MYDEBUG
|
#ifndef MYDEBUG
|
||||||
# define MYDEBUG 2 // 0 - no debugging
|
# define MYDEBUG 0 // 0 - no debugging
|
||||||
// 1 - use OutputDebugString
|
// 1 - use OutputDebugString
|
||||||
// 2 - use %temp%\ansicon.log
|
// 2 - use %temp%\ansicon.log
|
||||||
#endif
|
#endif
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
#include <winver.h>
|
#include <winver.h>
|
||||||
|
|
||||||
1 VERSIONINFO
|
1 VERSIONINFO
|
||||||
FILEVERSION 1,3,2,0
|
FILEVERSION 1,4,0,0
|
||||||
PRODUCTVERSION 1,3,2,0
|
PRODUCTVERSION 1,4,0,0
|
||||||
FILEOS VOS_NT
|
FILEOS VOS_NT
|
||||||
FILETYPE VFT_APP
|
FILETYPE VFT_APP
|
||||||
{
|
{
|
||||||
@ -19,12 +19,12 @@ FILETYPE VFT_APP
|
|||||||
VALUE "Comments", "http://ansicon.adoxa.cjb.net/"
|
VALUE "Comments", "http://ansicon.adoxa.cjb.net/"
|
||||||
VALUE "CompanyName", "Jason Hood"
|
VALUE "CompanyName", "Jason Hood"
|
||||||
VALUE "FileDescription", "ANSI Console"
|
VALUE "FileDescription", "ANSI Console"
|
||||||
VALUE "FileVersion", "1.32"
|
VALUE "FileVersion", "1.40"
|
||||||
VALUE "InternalName", "ansicon"
|
VALUE "InternalName", "ansicon"
|
||||||
VALUE "LegalCopyright", "Freeware"
|
VALUE "LegalCopyright", "Freeware"
|
||||||
VALUE "OriginalFilename", "ansicon.exe"
|
VALUE "OriginalFilename", "ansicon.exe"
|
||||||
VALUE "ProductName", "ANSICON"
|
VALUE "ProductName", "ANSICON"
|
||||||
VALUE "ProductVersion", "1.32"
|
VALUE "ProductVersion", "1.40"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
177
readme.txt
177
readme.txt
@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
ANSICON
|
ANSICON
|
||||||
|
|
||||||
Copyright 2005-2010 Jason Hood
|
Copyright 2005-2011 Jason Hood
|
||||||
|
|
||||||
Version 1.32. Freeware
|
Version 1.40. Freeware
|
||||||
|
|
||||||
|
|
||||||
===========
|
===========
|
||||||
@ -46,22 +46,33 @@
|
|||||||
Usage
|
Usage
|
||||||
=====
|
=====
|
||||||
|
|
||||||
|
Options (case sensitive):
|
||||||
|
|
||||||
|
-p Enable the parent process (i.e. the command shell used to
|
||||||
|
run ANSICON) to recognise escapes.
|
||||||
|
|
||||||
|
-m Set the current (and default) attribute to grey on black
|
||||||
|
("monochrome"), or the attribute following the `m' (please
|
||||||
|
use `COLOR /?' for attribute values).
|
||||||
|
|
||||||
|
-e Echo the command line - the character after the `e' is
|
||||||
|
ignored, the remainder is displayed verbatim.
|
||||||
|
|
||||||
|
-E As above, but no newline is added.
|
||||||
|
|
||||||
|
-t Display ("type") each file (or standard input if none or the
|
||||||
|
name is "-") as though they are a single file.
|
||||||
|
|
||||||
|
-T Display "==> FILE NAME <==", a blank line (or an error
|
||||||
|
message), the file and another blank line.
|
||||||
|
|
||||||
Running ANSICON with no arguments will start a new instance of the com-
|
Running ANSICON with no arguments will start a new instance of the com-
|
||||||
mand processor (the program defined by the `ComSpec' environment var-
|
mand processor (the program defined by the `ComSpec' environment var-
|
||||||
iable, typically `CMD.EXE'), or display standard input if it is redir-
|
iable, typically `CMD.EXE'), or display standard input if it is redir-
|
||||||
ected. Passing the option `-p' (case sensitive) will enable the parent
|
ected. Any argument will be treated as a program and its arguments.
|
||||||
process to recognise escapes (i.e. the command shell used to run ANSI-
|
|
||||||
CON). Use `-m' to set the current (and default) attribute to grey on
|
Eg: `ansicon -m30 -t file.ans' will display `file.ans' using black on
|
||||||
black ("monochrome"), or the attribute following the `m' (please use
|
cyan as the default color.
|
||||||
`COLOR /?' for attribute values). The option `-e' will echo the command
|
|
||||||
line - the character after the `e' is ignored, the remainder is display-
|
|
||||||
ed verbatim; use `-E' to prevent a newline being written. The option
|
|
||||||
`-t' will display each file (or standard input if none or it is "-"), as
|
|
||||||
though they are a single file; `-T' will display the file name (in be-
|
|
||||||
tween "==> " and " <=="), a blank line (or an error message), the file
|
|
||||||
and another blank line. Anything else will be treated as a program and
|
|
||||||
its arguments. Eg: `ansicon -m30 -t file.ans' will display `file.ans'
|
|
||||||
using black on cyan as the default color.
|
|
||||||
|
|
||||||
Once installed, the ANSICON environment variable will be created. This
|
Once installed, the ANSICON environment variable will be created. This
|
||||||
variable is of the form "WxH (wxh)", where W & H are the width and
|
variable is of the form "WxH (wxh)", where W & H are the width and
|
||||||
@ -90,38 +101,43 @@
|
|||||||
clicking Environment Variables (using XP; Vista/7 may be different).
|
clicking Environment Variables (using XP; Vista/7 may be different).
|
||||||
|
|
||||||
|
|
||||||
=========
|
====================
|
||||||
Sequences
|
Sequences Recognised
|
||||||
=========
|
====================
|
||||||
|
|
||||||
The following escape sequences are recognised.
|
The following escape sequences are recognised.
|
||||||
|
|
||||||
\e[#A CUU: CUrsor Up
|
\e[#A CUU CUrsor Up
|
||||||
\e[#B CUD: CUrsor Down
|
\e[#B CUD CUrsor Down
|
||||||
\e[#C CUF: CUrsor Forward
|
\e[#C CUF CUrsor Forward
|
||||||
\e[#D CUB: CUrsor Backward
|
\e[#D CUB CUrsor Backward
|
||||||
\e[#E CNL: Cursor Next Line
|
\e[#E CNL Cursor Next Line
|
||||||
\e[#F CPL: Cursor Preceding Line
|
\e[#F CPL Cursor Preceding Line
|
||||||
\e[#G CHA: Cursor Horizontal Absolute
|
\e[#G CHA Cursor Horizontal Absolute
|
||||||
\e[#;#H CUP: CUrsor Position
|
\e[#;#H CUP CUrsor Position
|
||||||
\e[#;#f HVP: Horizontal and Vertical Position
|
\e[#;#f HVP Horizontal and Vertical Position
|
||||||
\e[s SCP: Save Cursor Position
|
\e[s SCP Save Cursor Position
|
||||||
\e[u RCP: Restore Cursor Position
|
\e[u RCP Restore Cursor Position
|
||||||
\e[#J ED: Erase Display
|
\e[#J ED Erase Display
|
||||||
\e[#K EL: Erase Line
|
\e[#K EL Erase Line
|
||||||
\e[#L IL: Insert Lines
|
\e[#L IL Insert Lines
|
||||||
\e[#M DL: Delete Lines
|
\e[#M DL Delete Lines
|
||||||
\e[#@ ICH: Insert CHaracter
|
\e[#@ ICH Insert CHaracter
|
||||||
\e[#P DCH: Delete CHaracter
|
\e[#P DCH Delete CHaracter
|
||||||
\e[#;#;#m SGM: Set Graphics Mode
|
\e[#;#;#m SGM Set Graphics Mode
|
||||||
\e[#n DSR: Device Status Report
|
\e[#n DSR Device Status Report
|
||||||
\e[21t Report (xterm) window's title
|
\e[21t Report (xterm) window's title
|
||||||
\e]0;titleBEL Set (xterm) window's title (and icon)
|
\e]0;titleBEL Set (xterm) window's title (and icon)
|
||||||
|
\e[?25h DECTCEM DEC Text Cursor Enable Mode (show cursor)
|
||||||
|
\e[?25l DECTCEM DEC Text Cursor Enable Mode (hide cursor)
|
||||||
|
SO LS1 Lock shift G1 (see below)
|
||||||
|
SI LS0 Lock shift G0
|
||||||
|
|
||||||
`\e' represents the escape character (ASCII 27); `#' represents a
|
`\e' represents the escape character (ASCII 27); `#' represents a
|
||||||
decimal number (optional, in most cases defaulting to 1). Regarding
|
decimal number (optional, in most cases defaulting to 1); BEL, SO and
|
||||||
SGM: bold will set the foreground intensity; underline and blink will
|
SI are ASCII 7, 14 and 15. Regarding SGM: bold will set the foreground
|
||||||
set the background intensity; conceal uses background as foreground.
|
intensity; underline and blink will set the background intensity;
|
||||||
|
conceal uses background as foreground.
|
||||||
|
|
||||||
I make a distinction between "\e[m" and "\e[0;...m". Both will restore
|
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
|
the original foreground/background colors (and so "0" should be the
|
||||||
@ -129,6 +145,69 @@
|
|||||||
underline attributes, whilst the latter will explicitly reset them.
|
underline attributes, whilst the latter will explicitly reset them.
|
||||||
|
|
||||||
|
|
||||||
|
=================
|
||||||
|
Sequences Ignored
|
||||||
|
=================
|
||||||
|
|
||||||
|
The following escape sequences are explicitly ignored.
|
||||||
|
|
||||||
|
\e(? Designate G0 character set (`?' is anything).
|
||||||
|
\e)? Designate G1 character set (`?' is anything).
|
||||||
|
\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
|
||||||
|
==================================
|
||||||
|
|
||||||
|
This is my interpretation of the set, as shown by
|
||||||
|
http://vt100.net/docs/vt220-rm/table2-4.html.
|
||||||
|
|
||||||
|
|
||||||
|
Char Unicode Code Point & Name
|
||||||
|
---- -------------------------
|
||||||
|
_ U+0020 Space (blank)
|
||||||
|
` U+2666 Black Diamond Suit
|
||||||
|
a U+2592 Medium Shade
|
||||||
|
b U+2409 Symbol For Horizontal Tabulation
|
||||||
|
c U+240C Symbol For Form Feed
|
||||||
|
d U+240D Symbol For Carriage Return
|
||||||
|
e U+240A Symbol For Line Feed
|
||||||
|
f U+00B0 Degree Sign
|
||||||
|
g U+00B1 Plus-Minus Sign
|
||||||
|
h U+2424 Symbol For Newline
|
||||||
|
i U+240B Symbol For Vertical Tabulation
|
||||||
|
j U+2518 Box Drawings Light Up And Left
|
||||||
|
k U+2510 Box Drawings Light Down And Left
|
||||||
|
l U+250C Box Drawings Light Down And Right
|
||||||
|
m U+2514 Box Drawings Light Up And Right
|
||||||
|
n U+253C Box Drawings Light Vertical And Horizontal
|
||||||
|
o U+00AF Macron (SCAN 1)
|
||||||
|
p U+25AC Black Rectangle (SCAN 3)
|
||||||
|
q U+2500 Box Drawings Light Horizontal (SCAN 5)
|
||||||
|
r U+005F Low Line (SCAN 7)
|
||||||
|
s U+005F Low Line (SCAN 9)
|
||||||
|
t U+251C Box Drawings Light Vertical And Right
|
||||||
|
u U+2524 Box Drawings Light Vertical And Left
|
||||||
|
v U+2534 Box Drawings Light Up And Horizontal
|
||||||
|
w U+252C Box Drawings Light Down And Horizontal
|
||||||
|
x U+2502 Box Drawings Light Vertical
|
||||||
|
y U+2264 Less-Than Or Equal To
|
||||||
|
z U+2265 Greater-Than Or Equal To
|
||||||
|
{ U+03C0 Greek Small Letter Pi
|
||||||
|
| U+2260 Not Equal To
|
||||||
|
} U+00A3 Pound Sign
|
||||||
|
~ U+00B7 Middle Dot
|
||||||
|
|
||||||
|
|
||||||
|
G1-437.txt shows the glyphs according to code page 437; G1-UTF8.txt
|
||||||
|
according to UTF-8 (the file has no BOM).
|
||||||
|
|
||||||
|
|
||||||
===========
|
===========
|
||||||
Limitations
|
Limitations
|
||||||
===========
|
===========
|
||||||
@ -142,6 +221,9 @@
|
|||||||
|
|
||||||
Building rubyinstaller on Win7 crashes (XP is fine).
|
Building rubyinstaller on Win7 crashes (XP is fine).
|
||||||
|
|
||||||
|
Display of the DEC Special Graphics Character Set will depend on the
|
||||||
|
current font (the Symbols will probably not display correctly at all).
|
||||||
|
|
||||||
|
|
||||||
===============
|
===============
|
||||||
Version History
|
Version History
|
||||||
@ -149,6 +231,11 @@
|
|||||||
|
|
||||||
Legend: + added, - bug-fixed, * changed.
|
Legend: + added, - bug-fixed, * changed.
|
||||||
|
|
||||||
|
1.40 - 1 March, 2011:
|
||||||
|
- hook GetProcAddress (now PowerShell works);
|
||||||
|
+ add SO/SI, using the DEC Special Graphics Character Set for G1;
|
||||||
|
+ add DECTCEM to show/hide the cursor.
|
||||||
|
|
||||||
1.32 - 22 December, 2010:
|
1.32 - 22 December, 2010:
|
||||||
- fixed crash due to NULL lpNumberOfBytesWritten/lpNumberOfCharsWritten;
|
- fixed crash due to NULL lpNumberOfBytesWritten/lpNumberOfCharsWritten;
|
||||||
- -p will test the parent process for validity;
|
- -p will test the parent process for validity;
|
||||||
@ -248,6 +335,8 @@
|
|||||||
|
|
||||||
Luis Lavena and the Ruby people for additional improvements.
|
Luis Lavena and the Ruby people for additional improvements.
|
||||||
|
|
||||||
|
Leigh for documentation tweaks.
|
||||||
|
|
||||||
|
|
||||||
=======
|
=======
|
||||||
Contact
|
Contact
|
||||||
@ -275,5 +364,5 @@
|
|||||||
in the version text and a source diff is included.
|
in the version text and a source diff is included.
|
||||||
|
|
||||||
|
|
||||||
==============================
|
==========================
|
||||||
Jason Hood, 22 December, 2010.
|
Jason Hood, 1 March, 2011.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user