Added some more sequences; released v1.52.

This commit is contained in:
Jason Hood 2012-06-02 17:20:21 +10:00
parent 4f78bdba6d
commit b3e905eeae
3 changed files with 69 additions and 31 deletions

32
ANSI.c
View File

@ -82,9 +82,12 @@
fix 32-bit process trying to identify 64-bit process;
hook _lwrite & _hwrite.
v1.52, 10 April & 1 June, 2012:
v1.52, 10 April, 1 & 2 June, 2012:
use ansicon.exe to enable 32-bit to inject into 64-bit;
implement \e[39m & \e[49m (only setting color, nothing else).
implement \e[39m & \e[49m (only setting color, nothing else);
added the character/line equivalents (keaj`) of the cursor movement
sequences (ABCDG), as well as vertical absolute (d) and erase characters
(X).
*/
#include "ansicon.h"
@ -553,6 +556,17 @@ void InterpretEscSeq( void )
return;
}
case 'X': // ESC[#X Erase # characters.
if (es_argc == 0) es_argv[es_argc++] = 1; // ESC[X == ESC[1X
if (es_argc != 1) return;
FillConsoleOutputCharacter( hConOut, ' ', es_argv[0],
Info.dwCursorPosition,
&NumberOfCharsWritten );
FillConsoleOutputAttribute( hConOut, Info.wAttributes, es_argv[0],
Info.dwCursorPosition,
&NumberOfCharsWritten );
return;
case 'L': // ESC[#L Insert # blank lines.
if (es_argc == 0) es_argv[es_argc++] = 1; // ESC[L == ESC[1L
if (es_argc != 1) return;
@ -614,6 +628,7 @@ void InterpretEscSeq( void )
ScrollConsoleScreenBuffer( hConOut, &Rect, NULL, Pos, &CharInfo );
return;
case 'k': // ESC[#k
case 'A': // ESC[#A Moves cursor up # lines
if (es_argc == 0) es_argv[es_argc++] = 1; // ESC[A == ESC[1A
if (es_argc != 1) return;
@ -623,6 +638,7 @@ void InterpretEscSeq( void )
SetConsoleCursorPosition( hConOut, Pos );
return;
case 'e': // ESC[#e
case 'B': // ESC[#B Moves cursor down # lines
if (es_argc == 0) es_argv[es_argc++] = 1; // ESC[B == ESC[1B
if (es_argc != 1) return;
@ -632,6 +648,7 @@ void InterpretEscSeq( void )
SetConsoleCursorPosition( hConOut, Pos );
return;
case 'a': // ESC[#a
case 'C': // ESC[#C Moves cursor forward # spaces
if (es_argc == 0) es_argv[es_argc++] = 1; // ESC[C == ESC[1C
if (es_argc != 1) return;
@ -641,6 +658,7 @@ void InterpretEscSeq( void )
SetConsoleCursorPosition( hConOut, Pos );
return;
case 'j': // ESC[#j
case 'D': // ESC[#D Moves cursor back # spaces
if (es_argc == 0) es_argv[es_argc++] = 1; // ESC[D == ESC[1D
if (es_argc != 1) return;
@ -668,6 +686,7 @@ void InterpretEscSeq( void )
SetConsoleCursorPosition( hConOut, Pos );
return;
case '`': // ESC[#`
case 'G': // ESC[#G Moves cursor column # in current row.
if (es_argc == 0) es_argv[es_argc++] = 1; // ESC[G == ESC[1G
if (es_argc != 1) return;
@ -678,6 +697,15 @@ void InterpretEscSeq( void )
SetConsoleCursorPosition( hConOut, Pos );
return;
case 'd': // ESC[#d Moves cursor row #, current column.
if (es_argc == 0) es_argv[es_argc++] = 1; // ESC[d == ESC[1d
if (es_argc != 1) return;
Pos.Y = es_argv[0] - 1;
if (Pos.Y < 0) Pos.Y = 0;
if (Pos.Y >= Info.dwSize.Y) Pos.Y = Info.dwSize.Y - 1;
SetConsoleCursorPosition( hConOut, Pos );
return;
case 'f': // ESC[#;#f
case 'H': // ESC[#;#H Moves cursor to line #, column #
if (es_argc == 0)

View File

@ -66,7 +66,7 @@
pass process & thread identifiers on the command line (for x86->x64).
*/
#define PDATE L"1 June, 2012"
#define PDATE L"2 June, 2012"
#include "ansicon.h"
#include "version.h"

View File

@ -3,7 +3,7 @@
Copyright 2005-2012 Jason Hood
Version 1.51. Freeware
Version 1.52. Freeware
===========
@ -145,35 +145,42 @@
The following escape sequences are recognised.
\e[#A CUU CUrsor Up
\e[#B CUD CUrsor Down
\e[#C CUF CUrsor Forward
\e[#D CUB CUrsor Backward
\e]0;titleBEL Set (xterm) window's title (and icon)
\e[21t Report (xterm) window's title
\e[s Save Cursor
\e[u Restore Cursor
\e[#G CHA Cursor Character Absolute
\e[#E CNL Cursor Next Line
\e[#F CPL Cursor Preceding Line
\e[#G CHA Cursor Horizontal Absolute
\e[#;#H CUP CUrsor Position
\e[#;#f HVP Horizontal and Vertical Position
\e[s SCP Save Cursor Position
\e[u RCP Restore Cursor Position
\e[#J ED Erase Display
\e[#K EL Erase Line
\e[#L IL Insert Lines
\e[#M DL Delete Lines
\e[#@ ICH Insert CHaracter
\e[#P DCH Delete CHaracter
\e[#;#;#m SGM Set Graphics Mode
\e[#n DSR Device Status Report
\e[21t Report (xterm) window's title
\e]0;titleBEL Set (xterm) window's title (and icon)
\e[#D CUB Cursor Left
\e[#B CUD Cursor Down
\e[#C CUF Cursor Right
\e[#;#H CUP Cursor Position
\e[#A CUU Cursor Up
\e[#P DCH Delete Character
\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[#M DL Delete Line
\e[#n DSR Device Status Report
\e[#X ECH Erase Character
\e[#J ED Erase In Page
\e[#K EL Erase In Line
\e[#` HPA Character Position Absolute
\e[#j HPB Character Position Backward
\e[#a HPR Character Position Forward
\e[#;#f HVP Character And Line Position
\e[#@ ICH Insert Character
\e[#L IL Insert Line
SI LS0 Locking-shift Zero (see below)
SO LS1 Locking-shift One
\e[#;#;#m SGR Select Graphic Rendition
\e[#d VPA Line Position Absolute
\e[#k VPB Line Position Backward
\e[#e VPR Line Position Forward
`\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 SGM: bold will set the foreground
SI are ASCII 7, 14 and 15. Regarding SGR: bold will set the foreground
intensity; underline and blink will set the background intensity;
conceal uses background as foreground.
@ -258,9 +265,6 @@
The entire console buffer is used, not just the visible window.
The 64-bit version can inject into a 32-bit process, but the 32-bit
version will not inject into a 64-bit process.
Building rubyinstaller on Win7 crashes (XP is fine).
@ -270,6 +274,12 @@
Legend: + added, - bug-fixed, * changed.
1.52 - 2 June, 2012:
+ 32-bit processes can inject into 64-bit processes;
+ implemented \e[39m & \e[49m (set default foreground/background color);
+ added \e[#X, \e[#`, \e[#a, \e[#d, \e[#e, \[e#j and \e[#k;
* changed sequence descriptions to those in ECMA-48, ordered by acronym.
1.51 - 24 February, 2012:
- fixed installing into a piped/redirected CMD.EXE;
- fixed 32-bit process trying to identify a 64-bit process;
@ -422,5 +432,5 @@
in the version text and a source diff is included.
==============================
Jason Hood, 24 February, 2012.
=========================
Jason Hood, 2 June, 2012.