You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello everyone 👋. I was exploring this awesome library and started to improve my personal CLI tools with it, but unfortunately I have found an issue, which I wanted to share.
Information
OS: Windows
Version: 0.49.1
Terminal: Windows Terminal
Describe the bug
I have observed that live display of a table is not always properly recorded. For relatively small tables, when I call AnsiConsole.ExportText() after recording, it returns an empty string. However for large tables, it returns string with the full table output (as expected).
To Reproduce
Example C# program to simulate issue:
using Spectre.Console;
AnsiConsole.Record();
var table = new Table().Centered();
AnsiConsole
.Live(table)
.AutoClear(false)
.Start(ctx =>
{
table.AddColumn("Foo");
table.AddColumn("Bar");
for (int i = 0; i < 5; i++)
{
table.AddRow($"Foo {i}", $"Bar {i}");
}
});
var text = AnsiConsole.ExportText();
Console.WriteLine(text);
Expected behavior
In the example the value of a text is empty, but should contain an exported table output (the expected result of the whole example program is to print the same table twice). When I increase number of rows to for ex. 50 or 100, it produces the expected result.
Additional context
I want to be able to save my program live outputs into a file. Piping live outputs from shell is not possible/supported, and it throws System.IO.IOException (as described in this issue comment: #1393 (comment)), so the only reasonable way to do it seems to be: record, export and save into a file.
Possible fix/workaround
I have looked into the source code and found that method LiveDisplayRenderer.Completed(bool autoclear) forces to redraw when overflow occurs, which causes, the output to be correctly recorded and exported for larger tables.
As a workaround solution I have created small fix that turn this redraw behavior on, every time when recorder has been registered. You can see it on my fork: main...bmic86:spectre.console:fix/recording_on_live
Please upvote 👍 this issue if you are interested in it.
The text was updated successfully, but these errors were encountered:
Hello everyone 👋. I was exploring this awesome library and started to improve my personal CLI tools with it, but unfortunately I have found an issue, which I wanted to share.
Information
Describe the bug
I have observed that live display of a table is not always properly recorded. For relatively small tables, when I call
AnsiConsole.ExportText()
after recording, it returns an empty string. However for large tables, it returns string with the full table output (as expected).To Reproduce
Example C# program to simulate issue:
Expected behavior
In the example the value of a
text
is empty, but should contain an exported table output (the expected result of the whole example program is to print the same table twice). When I increase number of rows to for ex. 50 or 100, it produces the expected result.Additional context
I want to be able to save my program live outputs into a file. Piping live outputs from shell is not possible/supported, and it throws
System.IO.IOException
(as described in this issue comment: #1393 (comment)), so the only reasonable way to do it seems to be: record, export and save into a file.Possible fix/workaround
I have looked into the source code and found that method
LiveDisplayRenderer.Completed(bool autoclear)
forces to redraw when overflow occurs, which causes, the output to be correctly recorded and exported for larger tables.As a workaround solution I have created small fix that turn this redraw behavior on, every time when recorder has been registered. You can see it on my fork: main...bmic86:spectre.console:fix/recording_on_live
Please upvote 👍 this issue if you are interested in it.
The text was updated successfully, but these errors were encountered: