Last active
January 11, 2018 06:24
-
-
Save bdw429s/203287cb4345aa96c6177c08795b1a73 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
component { | |
property name='printer' inject='print'; | |
function run() { | |
var lines = [ | |
// bold text. Bold works on regular output, but not on prompt | |
'#chr(27)#[1mtest#chr(27)#[0m', | |
// bold GREEN text. Bold works on prompt but not on regular ouptut! | |
'#chr(27)#[1m#chr(27)#[32mtest#chr(27)#[0m', | |
// bold green text. Move the ESC[1 to AFTER the green code and suddendly both work!! | |
'#chr(27)#[32m#chr(27)#[1mtest#chr(27)#[0m', | |
// Two bold colors on backgrouds. The first sample is bold, but the second isn't on the prompt (note the bold escape code is still last here) | |
printer.boldblueOnWhite( 'blue on white' ) & printer.boldRedOnGreen( 'red on green' ), | |
// Same as above, but putting a space after the clear code suddendly makes bold work on both colors at the prompt! | |
printer.boldblueOnWhite( 'blue on white' ) & ' ' & printer.boldRedOnGreen( 'red on green' ) | |
]; | |
for( var ANSI in lines ) { | |
shell.printString( chr(10) ); | |
shell.printString( 'ANSI sequence:' & chr(10) ); | |
systemoutput( ANSI.replace( chr(27), 'ESC', 'all' ) & chr(10) ); | |
shell.printString( chr(10) ); | |
shell.printString( '"Regular" printed text:' & chr(10) ); | |
shell.printString( ANSI & chr(10) ); | |
shell.printString( chr(10) ); | |
shell.printString( 'Prompt:' & chr(10) ); | |
line = shell.getreader().readLine( ANSI ); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment