diff --git a/src/Spectre.Console.Tests/Expectations/Widgets/Table/Render_Fold.Output.verified.txt b/src/Spectre.Console.Tests/Expectations/Widgets/Table/Render_Fold.Output.verified.txt new file mode 100644 index 0000000..ad1ff93 --- /dev/null +++ b/src/Spectre.Console.Tests/Expectations/Widgets/Table/Render_Fold.Output.verified.txt @@ -0,0 +1,16 @@ +╔════════════════════════════╗ +║ ┌────────┬───────┬───────┐ ║ +║ │ Foo │ Bar │ Baz │ ║ +║ ├────────┼───────┼───────┤ ║ +║ │ Qux │ Corgi │ Waldo │ ║ +║ │ With A │ │ │ ║ +║ │ Long │ │ │ ║ +║ │ Descri │ │ │ ║ +║ │ ption │ │ │ ║ +║ │ Grault │ Garpl │ Fred │ ║ +║ │ │ y │ On A │ ║ +║ │ │ │ Long │ ║ +║ │ │ │ Long │ ║ +║ │ │ │ Walk │ ║ +║ └────────┴───────┴───────┘ ║ +╚════════════════════════════╝ diff --git a/src/Spectre.Console.Tests/Unit/TableTests.cs b/src/Spectre.Console.Tests/Unit/TableTests.cs index f5f2f6a..e222124 100644 --- a/src/Spectre.Console.Tests/Unit/TableTests.cs +++ b/src/Spectre.Console.Tests/Unit/TableTests.cs @@ -476,5 +476,26 @@ namespace Spectre.Console.Tests.Unit // Then return Verifier.Verify(console.Output); } + + [Fact] + [Expectation("Render_Fold")] + public Task Should_Render_With_Folded_Text_Table_Correctly() + { + // Given + var console = new TestConsole().Width(30); + var table = new Table(); + table.AddColumns("Foo", "Bar", "Baz"); + table.AddRow("Qux With A Long Description", "Corgi", "Waldo"); + table.AddRow("Grault", "Garply", "Fred On A Long Long Walk"); + + var panel = new Panel(table); + panel.Border = BoxBorder.Double; + + // When + console.Write(panel); + + // Then + return Verifier.Verify(console.Output); + } } } diff --git a/src/Spectre.Console/Widgets/Panel.cs b/src/Spectre.Console/Widgets/Panel.cs index 38a51f6..1202eac 100644 --- a/src/Spectre.Console/Widgets/Panel.cs +++ b/src/Spectre.Console/Widgets/Panel.cs @@ -99,6 +99,7 @@ namespace Spectre.Console var panelWidth = childWidth + edgeWidth; panelWidth = Math.Min(panelWidth, maxWidth); + childWidth = panelWidth - edgeWidth; var result = new List();