<commit_before>﻿using ImGui.Rendering;
using System;

namespace ImGui
{
    public partial class GUILayout
    {
        public static bool TreeNode(string text, ref bool open)
        {
            Window window = GetCurrentWindow();
            if (window.SkipItems)
                return false;

            BeginVertical(text + "_Tree");

            //get or create the root node
            int id = window.GetID(text);
            var container = window.RenderTree.CurrentContainer;
            var node = container.GetNodeById(id);
            text = Utility.FindRenderedText(text);
            if (node == null)
            {
                //create nodes
                node = new Node(id, $"TreeNode<{text}>");
                node.AttachLayoutEntry();
                node.UseBoxModel = true;
                node.RuleSet.Replace(GUISkin.Current[GUIControlName.TreeNode]);
            }
            container.AppendChild(node);
            var lineHeight = node.RuleSet.GetLineHeight();
            node.RuleSet.ApplyOptions(Height(lineHeight));<commit_msg>Add TreeNode overload without open-state argument<commit_after>﻿using ImGui.Rendering;
using System;

namespace ImGui
{
    public partial class GUILayout
    {
        public static bool TreeNode(string text)
        {
            Window window = GetCurrentWindow();
            int id = window.GetID(text);
            Storage storage = GetCurrentContext().StateStorage;

            var open = storage.GetBool(id);
            TreeNode(text, ref open);
            storage.SetBool(id, open);
            return open;
        }

        public static bool TreeNode(string text, ref bool open)
        {
            Window window = GetCurrentWindow();
            if (window.SkipItems)
                return false;

            BeginVertical(text + "_Tree");

            //get or create the root node
            int id = window.GetID(text);
            var container = window.RenderTree.CurrentContainer;
            var node = container.GetNodeById(id);
            text = Utility.FindRenderedText(text);
            if (node == null)
            {
                //create nodes
                node = new Node(id, $"TreeNode<{text}>");
                node.AttachLayoutEntry();
                node.UseBoxModel = true;
                node.RuleSet.Replace(GUISkin.Current[GUIControlName.TreeNode]);
            }
            container.AppendChild(node);
            var lineHeight = node.RuleSet.GetLineHeight();
            node.RuleSet.ApplyOptions(Height(lineHeight));
{'fraction_non_alphanumeric': 0.09254901960784313, 'fraction_numerical': 0.0, 'mean_word_length': 1.7459634015069967, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5778123', 'n_tokens_mistral': 646, 'n_tokens_neox': 630, 'n_words': 152}