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
PowerShell Preview: issue with host implementation dropping the first letter #1753
When prompting for input from the host (i.e. Read-Host or Get-Credential) the first letter that you type gets ignored resulting in the intended value of the command to be incorrect. It then writes the initial letter that got committed onto the next line in the console. Please see the gif below:
Expected Behaviour
From the example in the gif I would expect the output of the command to be test and then have an empty line to continue typing commands.
Actual Behaviour
The example in the gif shows that the initial t typed is not registered as part of the input and so the command outputs est and then you can see the intial t is the written in the console on the next line.
Attached Logs
Haven't attached logs as it's not crashing but let me know if you need me to.
Reacted by Cory Knox, Patrick Meinecke, brianmccarty, mrboring and JB Lewis
Yeah I believe this is due to an incorrect assumption on my part. I had thought that if two threads were invoking Console.ReadKey(true) at the same time (on Windows at least) then both threads would get the same key at the same time. I thought I had tested that, but it appears I did not.
A possible fix would be to use the same ReadKey override field we use for non-Windows to inject our ReadKey implementation.
ili101 looks like that's dropping a few characters on paste. A different issue than this one. Can you open a new issue so we can track this separately?
Activity
SydneyhSmith commentedon Feb 12, 2019
sk82jack thanks for reporting this, it looks like this is a buffer issue likely caused by the PSReadLine implementation.
Patrick Meinecke (@SeeminglyScience) any thoughts?
SeeminglyScience commentedon Feb 13, 2019
Yeah I believe this is due to an incorrect assumption on my part. I had thought that if two threads were invoking
Console.ReadKey(true)at the same time (on Windows at least) then both threads would get the same key at the same time. I thought I had tested that, but it appears I did not.A possible fix would be to use the same ReadKey override field we use for non-Windows to inject our
ReadKeyimplementation.ili101 commentedon Mar 31, 2019
I can confirm that it is still a problem in preview 2.
sba923 commentedon Jun 19, 2019
I confirm this issue; if I run the following script
and enter
12345I get:TylerLeonhardt commentedon Oct 24, 2019
I've got a PR out to fix this.
ili101 commentedon Nov 6, 2019
Not fully fixed
TylerLeonhardt commentedon Nov 6, 2019
ili101 looks like that's dropping a few characters on paste. A different issue than this one. Can you open a new issue so we can track this separately?