diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostRawUserInterface.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostRawUserInterface.cs index 8d90d6af0..af83258cf 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostRawUserInterface.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostRawUserInterface.cs @@ -1741,7 +1741,6 @@ namespace Microsoft.PowerShell { PSTraceSource.NewArgumentNullException("contents"); } - //if the cursor is on the last line, we need to make more space to print the specified buffer if (origin.Y == BufferSize.Height - 1 && origin.X >= BufferSize.Width) { @@ -1756,6 +1755,14 @@ namespace Microsoft.PowerShell } } +#if UNIX + // Make sure that the physical cursor position matches where we think it is. + // This is a problem on *nix, because input that the user types is echoed + // and that moves the cursor. As a consequence, the cursor needs to be repositioned + // before we update the screen. + CursorPosition = origin; +#endif + //iterate through the buffer to set foreach (var charitem in contents) {