You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Up and down arrow keys do not work on Linux or Mac due to Dotnet.core bug. #11
I looked into this and made a fixed on my local system and I was going to make a PR for it but this project is locked down I believed. So here what I did to make this great menu work on Linux and Mac so one can use the up and down arrow vs crashing out of the menu.
In file: PSMenu/Private/Read-VKey.ps1 I added the following:
try {
if ($IsLinux -or $IsMacOS) {
## A bug with Linux and Mac where arrow keys are return in 2 chars. First is esc follow by A,B,C,D
$key1 = $CurrentHost.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
if ($key1.VirtualKeyCode -eq 0x1B) {
## Found that we got an esc chair so we need to grab one more char
$key2 = $CurrentHost.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
## We just care about up and down arrow mapping here for now.
if ($key2.VirtualKeyCode -eq 0x41) {
# VK_UP = 0x26 up-arrow
$key1.VirtualKeyCode = 0x26
}
if ($key2.VirtualKeyCode -eq 0x42) {
# VK_DOWN = 0x28 down-arrow
$key1.VirtualKeyCode = 0x28
}
}
Return $key1
} else {
return $CurrentHost.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
}
}
changed the title [-]Up and down arrow keys do not work on Linux or Mac due to C# bug.[/-][+]Up and down arrow keys do not work on Linux or Mac due to Dotnet.core bug.[/+]on May 23, 2022
Activity
[-]Up and down arrow keys do not work on Linux or Mac due to C# bug.[/-][+]Up and down arrow keys do not work on Linux or Mac due to Dotnet.core bug.[/+]Sebazzz commentedon May 23, 2022
Thank you. I don't think the project is locked down, but I did just make a few commits so you might run into a merge conflict.
You mention there is a .NET bug - is it tracked upstream, and if so, under which number?
mark-hubers commentedon May 23, 2022
It is a hard problem to point out but here are some refs:
PowerShell/PowerShell#16443
dotnet/runtime#63387
PowerShell/PowerShell#16606
Sebazzz commentedon May 25, 2022
Thanks, released as v0.1.8!