mirror of
				https://github.com/nsnail/spectre.console.git
				synced 2025-11-04 18:40:50 +08:00 
			
		
		
		
	Add option to show separator between table rows (#1304)
* Add option to show separator between table rows * Panels should show header if borders are not shown Closes #835
This commit is contained in:
		@@ -32,6 +32,10 @@ public sealed class Ascii2TableBorder : TableBorder
 | 
			
		||||
            TableBorderPart.FooterBottom => "-",
 | 
			
		||||
            TableBorderPart.FooterBottomSeparator => "+",
 | 
			
		||||
            TableBorderPart.FooterBottomRight => "+",
 | 
			
		||||
            TableBorderPart.RowLeft => "|",
 | 
			
		||||
            TableBorderPart.RowCenter => "-",
 | 
			
		||||
            TableBorderPart.RowSeparator => "+",
 | 
			
		||||
            TableBorderPart.RowRight => "|",
 | 
			
		||||
            _ => throw new InvalidOperationException("Unknown border part."),
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -32,6 +32,10 @@ public sealed class AsciiDoubleHeadTableBorder : TableBorder
 | 
			
		||||
            TableBorderPart.FooterBottom => "-",
 | 
			
		||||
            TableBorderPart.FooterBottomSeparator => "+",
 | 
			
		||||
            TableBorderPart.FooterBottomRight => "+",
 | 
			
		||||
            TableBorderPart.RowLeft => "|",
 | 
			
		||||
            TableBorderPart.RowCenter => "-",
 | 
			
		||||
            TableBorderPart.RowSeparator => "+",
 | 
			
		||||
            TableBorderPart.RowRight => "|",
 | 
			
		||||
            _ => throw new InvalidOperationException("Unknown border part."),
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -32,6 +32,10 @@ public sealed class AsciiTableBorder : TableBorder
 | 
			
		||||
            TableBorderPart.FooterBottom => "-",
 | 
			
		||||
            TableBorderPart.FooterBottomSeparator => "-",
 | 
			
		||||
            TableBorderPart.FooterBottomRight => "+",
 | 
			
		||||
            TableBorderPart.RowLeft => "|",
 | 
			
		||||
            TableBorderPart.RowCenter => "-",
 | 
			
		||||
            TableBorderPart.RowSeparator => "+",
 | 
			
		||||
            TableBorderPart.RowRight => "|",
 | 
			
		||||
            _ => throw new InvalidOperationException("Unknown border part."),
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -32,6 +32,10 @@ public sealed class DoubleEdgeTableBorder : TableBorder
 | 
			
		||||
            TableBorderPart.FooterBottom => "═",
 | 
			
		||||
            TableBorderPart.FooterBottomSeparator => "╧",
 | 
			
		||||
            TableBorderPart.FooterBottomRight => "╝",
 | 
			
		||||
            TableBorderPart.RowLeft => "╟",
 | 
			
		||||
            TableBorderPart.RowCenter => "─",
 | 
			
		||||
            TableBorderPart.RowSeparator => "┼",
 | 
			
		||||
            TableBorderPart.RowRight => "╢",
 | 
			
		||||
            _ => throw new InvalidOperationException("Unknown border part."),
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -32,6 +32,10 @@ public sealed class DoubleTableBorder : TableBorder
 | 
			
		||||
            TableBorderPart.FooterBottom => "═",
 | 
			
		||||
            TableBorderPart.FooterBottomSeparator => "╩",
 | 
			
		||||
            TableBorderPart.FooterBottomRight => "╝",
 | 
			
		||||
            TableBorderPart.RowLeft => "╠",
 | 
			
		||||
            TableBorderPart.RowCenter => "═",
 | 
			
		||||
            TableBorderPart.RowSeparator => "╬",
 | 
			
		||||
            TableBorderPart.RowRight => "╣",
 | 
			
		||||
            _ => throw new InvalidOperationException("Unknown border part."),
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -35,6 +35,10 @@ public sealed class HeavyEdgeTableBorder : TableBorder
 | 
			
		||||
            TableBorderPart.FooterBottom => "━",
 | 
			
		||||
            TableBorderPart.FooterBottomSeparator => "┷",
 | 
			
		||||
            TableBorderPart.FooterBottomRight => "┛",
 | 
			
		||||
            TableBorderPart.RowLeft => "┠",
 | 
			
		||||
            TableBorderPart.RowCenter => "─",
 | 
			
		||||
            TableBorderPart.RowSeparator => "┼",
 | 
			
		||||
            TableBorderPart.RowRight => "┨",
 | 
			
		||||
            _ => throw new InvalidOperationException("Unknown border part."),
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -35,6 +35,10 @@ public sealed class HeavyHeadTableBorder : TableBorder
 | 
			
		||||
            TableBorderPart.FooterBottom => "─",
 | 
			
		||||
            TableBorderPart.FooterBottomSeparator => "┴",
 | 
			
		||||
            TableBorderPart.FooterBottomRight => "┘",
 | 
			
		||||
            TableBorderPart.RowLeft => "├",
 | 
			
		||||
            TableBorderPart.RowCenter => "─",
 | 
			
		||||
            TableBorderPart.RowSeparator => "┼",
 | 
			
		||||
            TableBorderPart.RowRight => "┤",
 | 
			
		||||
            _ => throw new InvalidOperationException("Unknown border part."),
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -35,6 +35,10 @@ public sealed class HeavyTableBorder : TableBorder
 | 
			
		||||
            TableBorderPart.FooterBottom => "━",
 | 
			
		||||
            TableBorderPart.FooterBottomSeparator => "┻",
 | 
			
		||||
            TableBorderPart.FooterBottomRight => "┛",
 | 
			
		||||
            TableBorderPart.RowLeft => "┣",
 | 
			
		||||
            TableBorderPart.RowCenter => "━",
 | 
			
		||||
            TableBorderPart.RowSeparator => "╋",
 | 
			
		||||
            TableBorderPart.RowRight => "┫",
 | 
			
		||||
            _ => throw new InvalidOperationException("Unknown border part."),
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -32,6 +32,10 @@ public sealed class HorizontalTableBorder : TableBorder
 | 
			
		||||
            TableBorderPart.FooterBottom => "─",
 | 
			
		||||
            TableBorderPart.FooterBottomSeparator => "─",
 | 
			
		||||
            TableBorderPart.FooterBottomRight => "─",
 | 
			
		||||
            TableBorderPart.RowLeft => "─",
 | 
			
		||||
            TableBorderPart.RowCenter => "─",
 | 
			
		||||
            TableBorderPart.RowSeparator => "─",
 | 
			
		||||
            TableBorderPart.RowRight => "─",
 | 
			
		||||
            _ => throw new InvalidOperationException("Unknown border part."),
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -5,6 +5,9 @@ namespace Spectre.Console.Rendering;
 | 
			
		||||
/// </summary>
 | 
			
		||||
public sealed class MarkdownTableBorder : TableBorder
 | 
			
		||||
{
 | 
			
		||||
    /// <inheritdoc />
 | 
			
		||||
    public override bool SupportsRowSeparator => false;
 | 
			
		||||
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public override string GetPart(TableBorderPart part)
 | 
			
		||||
    {
 | 
			
		||||
@@ -32,6 +35,10 @@ public sealed class MarkdownTableBorder : TableBorder
 | 
			
		||||
            TableBorderPart.FooterBottom => " ",
 | 
			
		||||
            TableBorderPart.FooterBottomSeparator => " ",
 | 
			
		||||
            TableBorderPart.FooterBottomRight => " ",
 | 
			
		||||
            TableBorderPart.RowLeft => " ",
 | 
			
		||||
            TableBorderPart.RowCenter => " ",
 | 
			
		||||
            TableBorderPart.RowSeparator => " ",
 | 
			
		||||
            TableBorderPart.RowRight => " ",
 | 
			
		||||
            _ => throw new InvalidOperationException("Unknown border part."),
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -32,6 +32,10 @@ public sealed class MinimalDoubleHeadTableBorder : TableBorder
 | 
			
		||||
            TableBorderPart.FooterBottom => " ",
 | 
			
		||||
            TableBorderPart.FooterBottomSeparator => " ",
 | 
			
		||||
            TableBorderPart.FooterBottomRight => " ",
 | 
			
		||||
            TableBorderPart.RowLeft => " ",
 | 
			
		||||
            TableBorderPart.RowCenter => "─",
 | 
			
		||||
            TableBorderPart.RowSeparator => "┼",
 | 
			
		||||
            TableBorderPart.RowRight => " ",
 | 
			
		||||
            _ => throw new InvalidOperationException("Unknown border part."),
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -35,6 +35,10 @@ public sealed class MinimalHeavyHeadTableBorder : TableBorder
 | 
			
		||||
            TableBorderPart.FooterBottom => " ",
 | 
			
		||||
            TableBorderPart.FooterBottomSeparator => " ",
 | 
			
		||||
            TableBorderPart.FooterBottomRight => " ",
 | 
			
		||||
            TableBorderPart.RowLeft => " ",
 | 
			
		||||
            TableBorderPart.RowCenter => "─",
 | 
			
		||||
            TableBorderPart.RowSeparator => "┼",
 | 
			
		||||
            TableBorderPart.RowRight => " ",
 | 
			
		||||
            _ => throw new InvalidOperationException("Unknown border part."),
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -32,6 +32,10 @@ public sealed class MinimalTableBorder : TableBorder
 | 
			
		||||
            TableBorderPart.FooterBottom => " ",
 | 
			
		||||
            TableBorderPart.FooterBottomSeparator => " ",
 | 
			
		||||
            TableBorderPart.FooterBottomRight => " ",
 | 
			
		||||
            TableBorderPart.RowLeft => " ",
 | 
			
		||||
            TableBorderPart.RowCenter => "─",
 | 
			
		||||
            TableBorderPart.RowSeparator => "┼",
 | 
			
		||||
            TableBorderPart.RowRight => " ",
 | 
			
		||||
            _ => throw new InvalidOperationException("Unknown border part."),
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -8,6 +8,9 @@ public sealed class NoTableBorder : TableBorder
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public override bool Visible => false;
 | 
			
		||||
 | 
			
		||||
    /// <inheritdoc />
 | 
			
		||||
    public override bool SupportsRowSeparator => false;
 | 
			
		||||
 | 
			
		||||
    /// <inheritdoc/>
 | 
			
		||||
    public override string GetPart(TableBorderPart part)
 | 
			
		||||
    {
 | 
			
		||||
 
 | 
			
		||||
@@ -35,6 +35,10 @@ public sealed class RoundedTableBorder : TableBorder
 | 
			
		||||
            TableBorderPart.FooterBottom => "─",
 | 
			
		||||
            TableBorderPart.FooterBottomSeparator => "┴",
 | 
			
		||||
            TableBorderPart.FooterBottomRight => "╯",
 | 
			
		||||
            TableBorderPart.RowLeft => "├",
 | 
			
		||||
            TableBorderPart.RowCenter => "─",
 | 
			
		||||
            TableBorderPart.RowSeparator => "┼",
 | 
			
		||||
            TableBorderPart.RowRight => "┤",
 | 
			
		||||
            _ => throw new InvalidOperationException("Unknown border part."),
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -35,6 +35,10 @@ public sealed class SimpleHeavyTableBorder : TableBorder
 | 
			
		||||
            TableBorderPart.FooterBottom => " ",
 | 
			
		||||
            TableBorderPart.FooterBottomSeparator => " ",
 | 
			
		||||
            TableBorderPart.FooterBottomRight => " ",
 | 
			
		||||
            TableBorderPart.RowLeft => "─",
 | 
			
		||||
            TableBorderPart.RowCenter => "─",
 | 
			
		||||
            TableBorderPart.RowSeparator => "─",
 | 
			
		||||
            TableBorderPart.RowRight => "─",
 | 
			
		||||
            _ => throw new InvalidOperationException("Unknown border part."),
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -32,6 +32,10 @@ public sealed class SimpleTableBorder : TableBorder
 | 
			
		||||
            TableBorderPart.FooterBottom => " ",
 | 
			
		||||
            TableBorderPart.FooterBottomSeparator => " ",
 | 
			
		||||
            TableBorderPart.FooterBottomRight => " ",
 | 
			
		||||
            TableBorderPart.RowLeft => "─",
 | 
			
		||||
            TableBorderPart.RowCenter => "─",
 | 
			
		||||
            TableBorderPart.RowSeparator => "─",
 | 
			
		||||
            TableBorderPart.RowRight => "─",
 | 
			
		||||
            _ => throw new InvalidOperationException("Unknown border part."),
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -32,6 +32,10 @@ public sealed class SquareTableBorder : TableBorder
 | 
			
		||||
            TableBorderPart.FooterBottom => "─",
 | 
			
		||||
            TableBorderPart.FooterBottomSeparator => "┴",
 | 
			
		||||
            TableBorderPart.FooterBottomRight => "┘",
 | 
			
		||||
            TableBorderPart.RowLeft => "├",
 | 
			
		||||
            TableBorderPart.RowCenter => "─",
 | 
			
		||||
            TableBorderPart.RowSeparator => "┼",
 | 
			
		||||
            TableBorderPart.RowRight => "┤",
 | 
			
		||||
            _ => throw new InvalidOperationException("Unknown border part."),
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user