Open christianrondeau opened 5 years ago
The problem with the "missing linebreak" also occurs on rendering a GridView in Region.Scrolling
Mode. when the whole grid is smaller than Console.WindowWidth
.
In this case the Cursor remains at the row end, when writting the next row, it is simply appended, as Region.Scrolling.Left
returns Console.CursorLeft
.
PR #1216 would resolve the issue as well, currently I am using a workaround (for my case) by simply setting last column to ColumnDefinition.Star(1)
which in fact does not help in case of resizing, but PR #1216 also not.
Also wrapping the table into a StackLayoutView
, like in
https://github.com/dotnet/command-line-api/blob/56139ef91d83b1ba86b8ffbd81e0f88298bd21ae/samples/RenderingPlayground/DirectoryTableView.cs#L9-L42
does not help: When selecting and copying text out of the terminal into a notepad, there are no line breaks.
When you run the TableView samples:
Try resizing your terminal window horizontally (reproduced using the default Windows console in PowerShell as well as in ConEmu) and you'll see the table layout breaking down.
I can pretty much solve the problem by sending a
\n
character to the console:https://github.com/dotnet/command-line-api/blob/732c0e685349a0e917e19fbe62bba4e26e430a3a/src/System.CommandLine.Rendering/Views/GridView.cs#L114
(I added a
renderer.LineBreak()
method here that did_terminal.Out.Write("\n");
but I didn't spend much time testing if it had side effects)