Windows ANSI escape sequences incorrectly positions cursor
Positioning the cursor on Windows with the ANSI CSI n;m H sequence ("\e[n;mH") incorrectly moves the cursor relative to the console BUFFER, and not the actual console window as would be expected.
print "\e[1;1H" should put the cursor in the top corner of the window, but instead it moves the cursor to the top of the internal DOS prompt buffer, and even moves the scrollbar to the top.
This is inconsistent with all other implementations of ANSI sequence processing on other platforms, and makes it hard to use simple cursor positioning sequences reliably on Windows.
IO.console.winsize does report the correct window size, which is good, but it's useless since the CSI H-sequence does not respect these size parameters.
Clear screen (CSI 2 J /
"\e[2J") also clears everything, instead of just the visible portion. CSI 3 J seems to be reserved for full clearing (source), but CSI 2 J should only clear the visible portion.
- Open a Windows command prompt with irb, where the buffer is larger than the window size (scrollbar visible)