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
to get input, since I do simultaneous thread/non-thread activities, while the user takes time writing his/her input.
Problem is that with PSReadLine the first Prompt after a script is executed already receives an "enter" thus it treats it as if the user wanted to skip the input. This however does not affect
[Console]::ReadKey()
Please advise.
The text was updated successfully, but these errors were encountered:
PSReadline calls Console.ReadKey, which ignores KeyUp events, and returns when it sees a KeyDown event. So after you press Enter (KeyDown), Console.ReadKey (and hence PSReadline) does not consume the KeyUp event.
The problem with that approach is that if the user holds the key for too long, there are redundant keys typed, when I would like only one per key press. The fallback I currently use is adding an extra $Host.UI.RawUI.ReadKey("IncludeKeyUp,NoEcho"); when I detect PSReadLine. This way the first "ghost-enter" gets consumed, and the apps behave normally.
A lot of my powershell apps rely on
to get input, since I do simultaneous thread/non-thread activities, while the user takes time writing his/her input.
Problem is that with PSReadLine the first Prompt after a script is executed already receives an "enter" thus it treats it as if the user wanted to skip the input. This however does not affect
[Console]::ReadKey()
Please advise.
The text was updated successfully, but these errors were encountered: