diff --git a/src/Spectre.Console/Widgets/Rows.cs b/src/Spectre.Console/Widgets/Rows.cs index 8e3e59576..91c963f03 100644 --- a/src/Spectre.Console/Widgets/Rows.cs +++ b/src/Spectre.Console/Widgets/Rows.cs @@ -41,8 +41,8 @@ protected override Measurement Measure(RenderOptions options, int maxWidth) if (measurements.Length > 0) { return new Measurement( - measurements.Min(c => c.Min), - measurements.Min(c => c.Max)); + measurements.Max(c => c.Min), + measurements.Max(c => c.Max)); } return new Measurement(0, 0); diff --git a/test/Spectre.Console.Tests/Expectations/Widgets/Rows/GH-1188-Rows.Output.verified.txt b/test/Spectre.Console.Tests/Expectations/Widgets/Rows/GH-1188-Rows.Output.verified.txt new file mode 100644 index 000000000..ed5efe628 --- /dev/null +++ b/test/Spectre.Console.Tests/Expectations/Widgets/Rows/GH-1188-Rows.Output.verified.txt @@ -0,0 +1,5 @@ +┌─────┐ +│ 1 │ +│ 22 │ +│ 333 │ +└─────┘ diff --git a/test/Spectre.Console.Tests/Unit/Widgets/RowsTests.cs b/test/Spectre.Console.Tests/Unit/Widgets/RowsTests.cs index 9d95e64bf..6937d842f 100644 --- a/test/Spectre.Console.Tests/Unit/Widgets/RowsTests.cs +++ b/test/Spectre.Console.Tests/Unit/Widgets/RowsTests.cs @@ -4,6 +4,29 @@ namespace Spectre.Console.Tests.Unit; [ExpectationPath("Widgets/Rows")] public sealed class RowsTests { + [Fact] + [Expectation("GH-1188-Rows")] + [GitHubIssue("https://github.com/spectreconsole/spectre.console/issues/1188")] + public Task Should_Render_Rows_In_Panel_Without_Breaking_Lines() + { + // Given + var console = new TestConsole().Width(60); + var rows = new Rows( + new IRenderable[] + { + new Text("1"), + new Text("22"), + new Text("333"), + }); + var panel = new Panel(rows); + + // When + console.Write(panel); + + // Then + return Verifier.Verify(console.Output); + } + [Fact] [Expectation("Render")] public Task Should_Render_Rows()