AnsiConsole.Write is overwriting output #673
-
Hello,
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This is a known limitation when rendering within a We calculate the updates based on the lines added to the buffer between every update, and if there is no newline at the time of the update, the content will be erased (since Spectre.Console doesn't know that any lines have been added). You can work around this by only rendering complete lines to the console. using System.Text;
using Spectre.Console;
AnsiConsole.Status()
.Spinner(Spinner.Known.Dots)
.Start("Conectando...", ctx =>
{
// Build up the line in separate steps
var builder = new StringBuilder();
builder.Append("[[[blue]INFO[/]]]");
builder.Append("[[[red]TEST[/]]]");
builder.Append("TEST TEST");
builder.AppendLine();
// Render whole string in one go
AnsiConsole.Markup(builder.ToString());
// Some expensive work
Thread.Sleep(1000);
}); |
Beta Was this translation helpful? Give feedback.
This is a known limitation when rendering within a
Status
orProgress
context.We calculate the updates based on the lines added to the buffer between every update, and if there is no newline at the time of the update, the content will be erased (since Spectre.Console doesn't know that any lines have been added).
This could probably be fixable but would require some work.
You can work around this by only rendering complete lines to the console.