From fb0e218eb1d17ee850d5c68f43154f4828d67ef7 Mon Sep 17 00:00:00 2001 From: Alex Jordan Date: Mon, 8 Aug 2016 21:57:25 -0700 Subject: [PATCH] Fix crash on file name being too long in prompt --- src/Microsoft.PowerShell.PSReadLine/ReadLine.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.PowerShell.PSReadLine/ReadLine.cs b/src/Microsoft.PowerShell.PSReadLine/ReadLine.cs index 609a31958..9c56bf928 100644 --- a/src/Microsoft.PowerShell.PSReadLine/ReadLine.cs +++ b/src/Microsoft.PowerShell.PSReadLine/ReadLine.cs @@ -557,13 +557,18 @@ namespace Microsoft.PowerShell _visualSelectionCommandCount = 0; _statusIsErrorMessage = false; - _consoleBuffer = ReadBufferLines(_initialY, 1 + Options.ExtraPromptLineCount); + #if UNIX // TODO: not necessary if ReadBufferLines worked, or if rendering worked on spans instead of complete lines string newPrompt = GetPrompt(); + var bufferLineCount = (newPrompt.Length) / (_console.BufferWidth) + 1; + _consoleBuffer = ReadBufferLines(_initialY, bufferLineCount); + for (int i=0; i