Skip to content

Commit 6dbb6a6

Browse files
committed
Fix command prompt cursor location issues while debugging
This change fixes an issue which causes the user's cursor location to jump around when they type the first letter after stepping through code or hitting multiple breakpoints sequentially. This is caused by a hanging input listener which wasn't respecting the cancellation of its task when it gets evaluated. Fixes PowerShell/vscode-powershell#698.
1 parent 97f4543 commit 6dbb6a6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/PowerShellEditorServices/Console/ConsoleReadLine.cs

+5-1
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,11 @@ private async Task<ConsoleKeyInfo> ReadKeyAsync(CancellationToken cancellationTo
476476

477477
lock (this.readKeyLock)
478478
{
479-
if (this.bufferedKey.HasValue)
479+
if (cancellationToken.IsCancellationRequested)
480+
{
481+
throw new TaskCanceledException();
482+
}
483+
else if (this.bufferedKey.HasValue)
480484
{
481485
keyInfo = this.bufferedKey.Value;
482486
this.bufferedKey = null;

0 commit comments

Comments
 (0)