Progress bar header and footer (#1262)

This commit is contained in:
Phil Scott
2023-09-16 16:39:43 -04:00
committed by GitHub
parent 3bee7212b7
commit ed9e198d60
6 changed files with 84 additions and 16 deletions

View File

@ -1,19 +1,28 @@
namespace Spectre.Console;
internal sealed class ControlCode : Renderable
/// <summary>
/// A control code.
/// </summary>
public sealed class ControlCode : Renderable
{
private readonly Segment _segment;
/// <summary>
/// Initializes a new instance of the <see cref="ControlCode"/> class.
/// </summary>
/// <param name="control">The control code.</param>
public ControlCode(string control)
{
_segment = Segment.Control(control);
}
/// <inheritdoc />
protected override Measurement Measure(RenderOptions options, int maxWidth)
{
return new Measurement(0, 0);
}
/// <inheritdoc />
protected override IEnumerable<Segment> Render(RenderOptions options, int maxWidth)
{
if (options.Ansi)

View File

@ -63,7 +63,7 @@ public sealed class Rows : Renderable, IExpandable
if (last)
{
if (!segment.IsLineBreak)
if (!segment.IsLineBreak && child is not ControlCode)
{
result.Add(Segment.LineBreak);
}