Fix crash on file name being too long in prompt

This commit is contained in:
Alex Jordan 2016-08-08 21:57:25 -07:00
parent 031ba8795b
commit fb0e218eb1

View file

@ -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<newPrompt.Length; ++i)
{
_consoleBuffer[i].UnicodeChar = newPrompt[i];
}
#else
_consoleBuffer = ReadBufferLines(_initialY, 1 + Options.ExtraPromptLineCount);
#endif
_lastRenderTime = Stopwatch.StartNew();