Skip to content

Commit

Permalink
Fixed PowerShell#58: Multi-line commands rendering wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
tig committed Mar 11, 2020
1 parent 5c5f12d commit 6af1903
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using OutGridView.Models;
using Terminal.Gui;

Expand Down Expand Up @@ -164,6 +165,11 @@ private static string GetPaddedString(List<string> strings, int[] colWidths, int
builder.Append(' ');
}

// Replace any newlines with encoded newline (`n)
// Note we can't use Environment.Newline because we don't know that the
// Command honors that.
strings[i] = strings[i].Replace("\n", "`n");

// If the string won't fit in the column, append an ellipsis.
if (strings[i].Length > colWidths[i])
{
Expand Down

0 comments on commit 6af1903

Please sign in to comment.