Skip to content

Commit a6a233a

Browse files
committed
Fix crash resizing console when showing longer menu
It happens due to a wrong height calculation
1 parent db76bc7 commit a6a233a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

PSMenu/Public/Show-Menu.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ function Show-Menu {
145145
$Position = Get-PositionWithVKey -MenuItems $MenuItems -Position $Position -VKeyCode $VKeyCode
146146

147147
If (!$(Test-KeyEscape $VKeyCode)) {
148-
[System.Console]::SetCursorPosition(0, [Console]::CursorTop - $MenuHeight)
148+
[System.Console]::SetCursorPosition(0, [Math]::Max(0, [Console]::CursorTop - $MenuHeight))
149149
& $WriteMenu
150150
}
151151

0 commit comments

Comments
 (0)