Skip to content

Fix issue 1153 on expanded tree#1245

Merged
patriksvensson merged 5 commits into
spectreconsole:mainfrom
davide-pi:fix/issue-1153-expanded-tree
Sep 9, 2024
Merged

Fix issue 1153 on expanded tree#1245
patriksvensson merged 5 commits into
spectreconsole:mainfrom
davide-pi:fix/issue-1153-expanded-tree

Conversation

@davide-pi

@davide-pi davide-pi commented Jun 21, 2023

Copy link
Copy Markdown

Description

Fix issue #1153

Examples

Before fix After fix
image image

To Test

To test the fix the following code was used.
Is sufficient to put it into the Main method of the Program.cs in the Spectre.Console.Analyzer.Sandbox to see the difference between expanded and not expanded trees.

NOTE: Curly brackets are used to simplify code duplication for test purposes only

      {
            AnsiConsole.MarkupLine("Expaded [green]default true[/]");
            var root = new Tree("root");
            root.AddNode("node1");
            root.AddNode("node2");
            AnsiConsole.Render(root);
        }

        AnsiConsole.MarkupLine("");
        AnsiConsole.MarkupLine("");

        {
            AnsiConsole.MarkupLine("Expaded [red]false[/] in init");
            var root = new Tree("root") { Expanded = false };
            root.AddNode("node1");
            root.AddNode("node2");
            AnsiConsole.Render(root);
        }
        AnsiConsole.MarkupLine("");
        {
            AnsiConsole.MarkupLine("Expaded [green]true[/] in init");
            var root = new Tree("root") { Expanded = true };
            root.AddNode("node1");
            root.AddNode("node2");
            AnsiConsole.Render(root);
        }

        AnsiConsole.MarkupLine("");
        AnsiConsole.MarkupLine("");

        {
            AnsiConsole.MarkupLine("Expaded [red]false[/] after init");
            var root = new Tree("root");
            root.Expanded = false;
            root.AddNode("node1");
            root.AddNode("node2");
            AnsiConsole.Render(root);
        }
        AnsiConsole.MarkupLine("");
        {
            AnsiConsole.MarkupLine("Expaded [green]true[/] after init");
            var root = new Tree("root");
            root.Expanded = true;
            root.AddNode("node1");
            root.AddNode("node2");
            AnsiConsole.Render(root);
        }

Please upvote 👍 this pull request if you are interested in it.

@davide-pi

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@patriksvensson patriksvensson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@patriksvensson

Copy link
Copy Markdown
Contributor

@davide-pi Looks good to me, but the PR must be rebased against main before we can merge it

@davide-pi

Copy link
Copy Markdown
Author

Thanks @patriksvensson I've merged the PR with the las changes in main!

@patriksvensson patriksvensson merged commit f8a4b22 into spectreconsole:main Sep 9, 2024
@davide-pi davide-pi deleted the fix/issue-1153-expanded-tree branch September 9, 2024 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants