Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Live Layout] Partial update, Fixed Header and Footer, Update only middle Content #1345

Open
w4po opened this issue Oct 25, 2023 · 2 comments

Comments

@w4po
Copy link

w4po commented Oct 25, 2023

Hello,

I was trying to do a layout consisting of a Header and a content,
I want the header to be fixed,

Something like:

var layout = new Layout()
    .SplitRows(
        new Layout("Header", new FigletText("FIGLET")),
        new Layout("Content").Ratio(2));

AnsiConsole.Write(layout);

await AnsiConsole
    .Progress()
    .UseRenderHook((renderable, _) => layout["Content"].Update(renderable))
    .StartAsync(async ctx =>
    {
        var task = ctx.AddTask("Downloading:");
        while (!ctx.IsFinished)
        {
            await Task.Delay(150).ConfigureAwait(false);
            task.Increment(0.7);
        }
    }).ConfigureAwait(false);

So it would be really nice if we could trigger a redraw to update only part of the layout with: layout["Content"].Update(renderable);

Is that possible? Thank you very much for the awesome work <3.


Please upvote 👍 this issue if you are interested in it.

@heroboy
Copy link

heroboy commented Nov 30, 2023

I would like a ProgressBar widget.
code maybe:

var progress = new ProgressBar("downloading");
var layout = new Layout()
    .SplitRows(
        new Layout("Header", new FigletText("FIGLET")),
        new Layout("Content", progress ));



await AnsiConsole.Live(layout)
    .StartAsync(async ctx =>
    {
        for(int i = 0;i<100;++i)
        {
            await Task.Delay(150).ConfigureAwait(false);
            progress .Increment(0.01);
        }
    }).ConfigureAwait(false);

@patriksvensson
Copy link
Contributor

It is not possible to partially update a layout. This is by design and nothing I see that we will add support for since it would require a complete rewrite of most of the library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo 🕑
Development

No branches or pull requests

3 participants