Well, there's lots and lots of changes in this release, and some of them are even noticeable to end users! I finally got some motivation to clean up and do some refactoring after looking at what Jachymko's been doing, so I've made a start at that -- the impact on the end user is mostly limited to some improvements in the threading behavior. So, welcome to jachymko
, who's working on a .Net 3.5 fork (which you can get from our source repository
) and feeding in lots of ideas and code -- he's even got a working WCF remoting implementation (but it's not ready for release).
I added a separate "Colors" settings class in $Host.PrivateData
and moved the color settings in there, and also added color settings for the debug, error, verbose, and warning messages, as well as separate
color settings for 'native' output and input.
- Created a XAML version of the startup splash logo which is almost perfect, and will scale nicely.
- Fixed the scrollbar visibility (it's now bound to the settings so it's set correctly at startup now)
- Modified Logo XAML to use Bitstream Mono instead of Consolas (which I can't distribute)
- Fixed the tab-complete double-tap (there's a setting for the number of miliseconds)
- Embedded the Bitstream Vera Sans Mono font so that the console always has a fallback monospace font.
- Removed the embedded fonts into a resource-only assembly (FontLibrary.dll).
- Moved the StartupBanner into a standalone XAML file which is easily user editable.
- Added Scroll Lock function -- when Scroll Lock is on, it turns off the use of up/down and pg up/pg down to navigate the history, and allows you to freely navigate and select text in the buffer with your keyboard.
ANSI Escape Sequences
The weirdest thing in this release is some ANSI escape sequence support: you can now put ANSI escape sequences into your strings and get formatted output! Just start with [char]27[
and continue with semi-colon delimited standard ANSI codes for colors
- 30-37 for foreground
- 40-47 for background
- a 1 will set it to the bright version of colors that follow
- a 2 chooses the dark version of colors that follow
- a 4 is underline
- a 5 is italic -- not blink, sorry ;-)
- a 7 is bold -- not reverse, you can do that yourself
- an 8 is .. uhm .. "thin" (which probably won't be noticeable in most fonts)
You can terminate the ANSI sequence with an m
like you're supposed to, or you can terminate with a closing square brace. As a bonus, if you enclose it with square braces you can use words like italic and bold and underline, and the names from the ConsoleColors enumeration (which are the plain color names in $Host.PrivateData.Colors): the first name sets the foreground, the second sets the background. You can even use custom colors by specifying a HEX color like HTML colors (with an optional alpha blending.
There is a problem, however: PowerShell miscalculates the text length because it doesn't know the escaped formatting codes will be removed. Using color names or hex string makes that worse because they are that much longer. Anyway, this is mostly just "for fun" ... we'll produce a Write-Posh cmdlet soon which will support all our formatting options.