Use WrapSize for WindowSize when unavailable
This commit is contained in:
parent
7afe9aa60f
commit
b67d765b3a
2 changed files with 12 additions and 2 deletions
|
@ -1653,7 +1653,17 @@ namespace Microsoft.PowerShell
|
|||
/// </summary>
|
||||
public override Size WindowSize
|
||||
{
|
||||
get { return new Size(Console.WindowWidth, Console.WindowHeight); }
|
||||
get
|
||||
{
|
||||
if (Console.IsOutputRedirected)
|
||||
{
|
||||
return WrapSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
return new Size(Console.WindowWidth, Console.WindowHeight);
|
||||
}
|
||||
}
|
||||
set { Console.SetWindowSize(value.Width, value.Height); }
|
||||
}
|
||||
|
||||
|
|
|
@ -1148,7 +1148,7 @@ namespace Microsoft.PowerShell
|
|||
// we leave a 1-cell margin on the end because if the very last character butts up against the
|
||||
// edge of the screen buffer, then the console will wrap the line.
|
||||
|
||||
List<string> lines = WrapText(text, RawUI.BufferSize.Width - 1);
|
||||
List<string> lines = WrapText(text, RawUI.WindowSize.Width - 1);
|
||||
int count = 0;
|
||||
foreach (string s in lines)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue