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

Using print_node_function in Term.Tree overwrites title #236

Open
SyxP opened this issue Nov 20, 2023 · 1 comment
Open

Using print_node_function in Term.Tree overwrites title #236

SyxP opened this issue Nov 20, 2023 · 1 comment

Comments

@SyxP
Copy link

SyxP commented Nov 20, 2023

As seen in #206 , the title is overwritten.

@SyxP
Copy link
Author

SyxP commented Nov 20, 2023

Can be workaround with

function DisplayDictAsTree(myDict, Title = "")
    function pn(io, node; kw...)
        # https://github.com/FedeClaudi/Term.jl/issues/206
        if node == myDict
            print(io, Title)
        elseif node isa AbstractDict
            print(io, string(typeof(node)))
        else
            print(io, node)
        end
    end
    Term.Tree(myDict; print_node_function = pn)
end

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

No branches or pull requests

1 participant