Wednesday, April 15, 2009

Making PowerTab 0.99 Beta 2 work on PowerShell V2 (CTP3)

Being very fond of PowerTab, it has been a loss that it did not work for PowerShell V2. But it turns out to be very simple to fix the problem. It fails as the parameter signature for $host.ui.rawui.NewBufferCellArray seems to have changed in V2.

Fixing the problem is a matter of changing two lines in <PowerTabDir>\TabExpansion.ps1. The old line is commented out -

#      $message = $host.ui.rawui.NewBufferCellArray(@('[Tab]'),'Yellow','Blue')
$message = $host.ui.rawui.NewBufferCellArray(@('[Tab]'),[consolecolor]::Yellow,[consolecolor]::blue)


#      $message = $host.ui.rawui.NewBufferCellArray(@('[Err]'),'Yellow','Red')
$message = $host.ui.rawui.NewBufferCellArray(@('[Tab]'),[consolecolor]::Yellow,[consolecolor]::red)

Have fun!


PS: It does not work in ISE


MOW said...

Good catch, I did same fix

As I was on Win7 until lately I did not update, I will try to post an updated version soon.

The reason PowerTab does not work in ISE is that RawUI is not supported.

you can make PowerTab work in ISE by disabling the menu

$powertabconfig.defaulthandler = 'default'

as well as the Tabindicator (that also uses RawUI )

Greetings MOW

Per Østergaard said...

Hi Mow! Nice hearing from you, I'l adopt the ISE fix right away. Thanks for that.

Anonymous said...

Hi, do you know how I can fix the up arrow crash of powertab when trying to navigate in the console?

Per Østergaard said...

MOW released an official fix: