Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Spectre.Console/Widgets/Table/TableRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@ public static List<Segment> Render(TableRendererContext context, List<int> colum
result.Add(Segment.LineBreak);
}

// Show row separator?
// Show row separator, if headers are hidden show separator after the first row
if (context.Border.SupportsRowSeparator && context.ShowRowSeparators
&& !isFirstRow && !isLastRow)
&& (!isFirstRow || (isFirstRow && !context.ShowHeaders)) && !isLastRow)
{
var hasVisibleFootes = context is { ShowFooters: true, HasFooters: true };
var isNextLastLine = index == context.Rows.Count - 2;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
┌────────┬────────┐
│ Qux │ Corgi │
├────────┼────────┤
│ Waldo │ Grault │
├────────┼────────┤
│ Garply │ Fred │
└────────┴────────┘
23 changes: 23 additions & 0 deletions test/Spectre.Console.Tests/Unit/Widgets/Table/TableTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,29 @@ public Task Should_Render_Table_With_Row_Separators_Correctly()
return Verifier.Verify(console.Output);
}

[Fact]
[Expectation("Render_Row_Separators_No_Header")]
public Task Should_Render_Table_With_Row_Separators_No_Header_Correctly()
{
// Given
var console = new TestConsole();
var table = new Table();

table.ShowRowSeparators();
table.HideHeaders();

table.AddColumns("Foo", "Bar");
table.AddRow("Qux", "Corgi");
table.AddRow("Waldo", "Grault");
table.AddRow("Garply", "Fred");

// When
console.Write(table);

// Then
return Verifier.Verify(console.Output);
}

[Fact]
[Expectation("Render_EA_Character")]
public Task Should_Render_Table_With_EA_Character_Correctly()
Expand Down