-
Notifications
You must be signed in to change notification settings - Fork 643
Closed
Labels
bugSomething isn't workingSomething isn't workingneeds triageSomeone needs to take a look at thisSomeone needs to take a look at this
Milestone
Description
Information
- OS: Windows 10
- Version: 0.46
- Terminal: Windows Terminal
Describe the bug
Using a centered figlet inside of rows leads to an exception, when there is another 'small element' present.
To Reproduce
Here is a minimal console app to reproduce the bug:
using Spectre.Console;
var rows = new Rows(
new Markup("Short"), // omitting this markup altogether or making the string leads to no exception
new FigletText("Some other string").Centered()); // using left- or right-justified leads to no exception in any case
var panel = new Panel(rows);
AnsiConsole.Write(panel);Note: Either removing the first IRenderable, or making its content bigger by passign a longer string will make it not throw.
Here's the StackTrace:
Unhandled exception. System.ArgumentOutOfRangeException: Count cannot be less than zero. (Parameter 'count')
at System.String.Ctor(Char c, Int32 count)
at Spectre.Console.Rendering.Segment.Padding(Int32 size) in /_/src/Spectre.Console/Rendering/Segment.cs:line 53
at Spectre.Console.FigletText.Render(RenderOptions options, Int32 maxWidth)+MoveNext() in /_/src/Spectre.Console/Widgets/Figlet/Figl
etText.cs:line 73
at Spectre.Console.EnumerableExtensions.Enumerate[T](IEnumerator`1 source)+MoveNext() in /_/src/Spectre.Console/Internal/Extensions/
EnumerableExtensions.cs:line 102
at Spectre.Console.Rows.Render(RenderOptions options, Int32 maxWidth) in /_/src/Spectre.Console/Widgets/Rows.cs:line 55
at Spectre.Console.Rendering.Renderable.Spectre.Console.Rendering.IRenderable.Render(RenderOptions options, Int32 maxWidth) in /_/sr
c/Spectre.Console/Rendering/Renderable.cs:line 19
at Spectre.Console.Padder.Render(RenderOptions options, Int32 maxWidth) in /_/src/Spectre.Console/Widgets/Padder.cs:line 69
at Spectre.Console.Rendering.Renderable.Spectre.Console.Rendering.IRenderable.Render(RenderOptions options, Int32 maxWidth) in /_/sr
c/Spectre.Console/Rendering/Renderable.cs:line 19
at Spectre.Console.Panel.Render(RenderOptions options, Int32 maxWidth) in /_/src/Spectre.Console/Widgets/Panel.cs:line 137
at Spectre.Console.Rendering.Renderable.Spectre.Console.Rendering.IRenderable.Render(RenderOptions options, Int32 maxWidth) in /_/sr
c/Spectre.Console/Rendering/Renderable.cs:line 19
at Spectre.Console.RenderableExtensions.GetSegments(IAnsiConsole console, RenderOptions options, IEnumerable`1 renderables) in /_/sr
c/Spectre.Console/Extensions/RenderableExtensions.cs:line 37
at Spectre.Console.RenderableExtensions.GetSegments(IRenderable renderable, IAnsiConsole console) in /_/src/Spectre.Console/Extensio
ns/RenderableExtensions.cs:line 29
at Spectre.Console.AnsiBuilder.Build(IAnsiConsole console, IRenderable renderable) in /_/src/Spectre.Console/Internal/Backends/Ansi/
AnsiBuilder.cs:line 17
at Spectre.Console.AnsiConsoleBackend.Write(IRenderable renderable) in /_/src/Spectre.Console/Internal/Backends/Ansi/AnsiConsoleBack
end.cs:line 30
at Spectre.Console.AnsiConsoleFacade.Write(IRenderable renderable) in /_/src/Spectre.Console/Internal/Backends/AnsiConsoleFacade.cs:
line 40
at Spectre.Console.AnsiConsole.Write(IRenderable renderable) in /_/src/Spectre.Console/AnsiConsole.Rendering.cs:line 29
at Program.<Main>$(String[] args) in C:\Repos\SpectrePanelBug\SpectrePanelBug\Program.cs:line 7
Expected behavior
As I can pass a collection of IRenderables into Rows, I'd expect it not to throw under any such circumstance.
Screenshots
If applicable, add screenshots to help explain your problem.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingneeds triageSomeone needs to take a look at thisSomeone needs to take a look at this