Windows 10 native sequences
adoxa opened this issue · 5 comments
Windows 10.0.10586 natively supports the following escapes (in the "new" console, not the legacy).
ESC 7 DECSC Save Cursor - only saves cursor position, nothing else
ESC 8 DECSR Restore Cursor
ESC A VT52 equivalent of ESC [ A
ESC B
ESC C
ESC D
ESC [ c DA1
ESC [ 0 c DA1
ESC [ ? 1 ; 0 c response = VT101
ESC [ 6 n CPR Cursor Position Report Request
ESC [ ? 25 h DECTCEM Set Text Cursor Enable Mode (visible)
ESC [ ? 25 l DECTCEM Reset Text Cursor Enable Mode (invisible)
ESC [ ... m SGR Select Graphic Rendition
1 sets bright fg intensity (but only after fg colour
e.g. "1;37" still sets grey, "37;1" sets white)
4 underline works (standard attribute 0x8000)
8 concealed does not
22 does not remove bold
3x sets normal intensity (removing bright)
9x sets bright fg
10x sets bright background
ESC [ Pl A CUU Cursor Up
ESC [ Pl B CUD Cursor Down
ESC [ Pc C CUF Cursor Forward
ESC [ Pc D CUB Cursor Backward
ESC [ Pn E CNL Cursor Next Line
ESC [ Pn F CPL Cursor Previous Line
ESC [ Pn G CHA Cursor Horizontal Absolute
ESC [ Pl ; Pc H CUP Cursor Position
ESC [ Ps J ED Erase in Display
ESC [ Ps K EL Erase in Line
ESC [ Pn P DCH Delete Character
ESC [ Pn @ ICH Insert Character
ESC [ Pn d VPA Vertical Line Position Absolute
ESC ] ... BEL OSC ignored
They operate on the current window.
OOI, now that Windows 10 new console SEEMS to support colour, how can we get the dimensions of the terminal using ANSI from a non-C environment (think PHP/Perl/Python/etc.).
From my VERY VERY old memory ...
Remember the current position.
Set the position to some silly high x,y
Get the current position.
Reset to the first position.
Or is there an easier way?
Other languages typically provide a way to access the Windows API directly, so with a bit of mucking about you could call GetConsoleScreenBufferInfo
and get the dimensions that way. Not exactly easier, but more direct. It seems PHP does not offer that, so an alternative would be to run something like my cs
utility and extract it from that; but again, not exactly easier.
I think sticking with ANSICON for the time being is the simplest option.
There's at least one undocumented sequence (at least on 15063): ESC c
RIS
does a hard reset (Reset to Initial State).