Created
August 4, 2014 19:04
-
-
Save waldronj/0a30ee0964e924e6e4f0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| function Size($w, $h) | |
| { | |
| New-Object System.Management.Automation.Host.Size($w, $h) | |
| } | |
| function resize() | |
| { | |
| Write-Host '[Arrows] resize [Esc] exit ...' | |
| $ErrorActionPreference = 'SilentlyContinue' | |
| for($ui = $Host.UI.RawUI;;) { | |
| $b = $ui.BufferSize | |
| $w = $ui.WindowSize | |
| switch($ui.ReadKey(6).VirtualKeyCode) { | |
| 37 { | |
| $w = Size ($w.width - 1) $w.height | |
| $ui.WindowSize = $w | |
| $ui.BufferSize = Size $w.width $b.height | |
| break | |
| } | |
| 39 { | |
| $w = Size ($w.width + 1) $w.height | |
| $ui.BufferSize = Size $w.width $b.height | |
| $ui.WindowSize = $w | |
| break | |
| } | |
| 38 { | |
| $ui.WindowSize = Size $w.width ($w.height - 1) | |
| break | |
| } | |
| 40 { | |
| $w = Size $w.width ($w.height + 1) | |
| if ($w.height -gt $b.height) { | |
| $ui.BufferSize = Size $b.width $w.height | |
| } | |
| $ui.WindowSize = $w | |
| break | |
| } | |
| 27 { | |
| return | |
| } | |
| } | |
| } | |
| }re |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment