Mpdreamz/shellprogressbar

Only two levels displayed if ProgressBarOnBottom = true

GeneratedNickname opened this issue · 1 comments

Example code:

                var progressBarOptions = new ProgressBarOptions
                {
                    CollapseWhenFinished = true,
                    ProgressBarOnBottom = true,
                    DisplayTimeInRealTime = true,
                    ForegroundColor = ConsoleColor.White
                };

                using (var l1Bar =
                    new ProgressBar(10, "Level 1", progressBarOptions))
                {
                    for (int i = 0; i < 10; i++)
                    {
                        using (var l2Bar =
                            l1Bar.Spawn(10, $"Level 2 [{i}]", progressBarOptions))
                        {
                            for (int j = 0; j < 10; j++)
                            {
                                using (var l3Bar =
                                    l2Bar.Spawn(10, $"Level 3 [{j}]", progressBarOptions))
                                {
                                    for (int k = 0; k < 10; k++)
                                    {
                                        Thread.Sleep(200);
                                        l3Bar.Tick();
                                    }
                                }
                                l2Bar.Tick($"Level 2 [{i}]");
                            }
                        }
                        l1Bar.Tick();
                    }
                }

When ProgressBarOnBottom is set to true only two bars appear. When the option is commented out, all three will appear.

After some debugging I think I found the issue, fixed it and made a pull request here #75