Skip to content

Instantly share code, notes, and snippets.

@iarna
Last active December 15, 2015 21:48
Show Gist options
  • Save iarna/58553b13c477de79069e to your computer and use it in GitHub Desktop.
Save iarna/58553b13c477de79069e to your computer and use it in GitHub Desktop.
Console Capability Tests

These is a basic console capability test. Clone this repo (https://gist.github.com/58553b13c477de79069e.git) and use node cat console-test.txt to dump the test to your screen. (On Mac & Linux you can just use cat.) There's also a hide-cursor.txt and show-cursor.txt that should do what they say.

All of this is about me trying to figure out what actually is shared cross platform and what isn't.

What I've learned so far is:

  • Windows & OSX both support cursor controls (to my surprise!)
  • Windows does not support italics or underline (no surprise)
  • Examining of Windows behaving around positioning ^[[1;1H and screen clearing ^[[J, seems to imply that it treats the line the program started on as 1,1 for positioning purposes and there's no way to position above your starting line.
  • Region scroll events are not supported on Windows.

Output on different terminals:

OSX Terminal (uncustomized)

Uncustomized Terminal.app

iTerm2 (customized colors)

Heavily customized iTerm2

Windows cmd.exe

Windows cmd.exe

Windows Git Shell

Windows Git Shell

Windows PowerShell

Windows PowerShell

'use strict'
var fs = require('fs')
fs.createReadStream(process.argv[2]).pipe(process.stdout)
1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.line 10line 11over 20back 17start!
garbage garbage15# 14# fakeo line 23actual line 23456789!123456789@123456789#1234567890$123456789%123456789^123456789&123456789bold italic underline inverse nb ni nu iiwhite black blue cyan green magenta red yellow brightWhite brightBlack brightBlue brightCyan brightGreen brightMagenta brightRed brightYellow white black blue cyan green magenta red yellow brightWhite brightBlack brightBlue brightCyan brightGreen brightMagenta brightRed brightYellow 
@nexdrew
Copy link

nexdrew commented Dec 15, 2015

Interesting! I would probably throw cmder in the mix for Windows terminals - most "devs on Windows" that I know use it. If I had a Windows environment immediately available, I'd go ahead and run these tests myself. :P

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment