<commit_before>﻿using ConsoleUI;

namespace ConsoleApplication1
{
    internal static class KeyPressedEvents
    {
        internal static void SetupListBoxScreens(ScreenCollection screens)
        {
            ListBoxPopup(screens);
        }

        private static void ListBoxPopup(ScreenCollection screens)
        {
            var screen = new Screen("List Box Pop Up");

            var control1 = new ListBox();

            control1.Left = 0;
            control1.Top = 0;
            control1.Width = screen.Width; ;
            control1.Height = screen.Height - 1;
            control1.BorderStyle = BorderStyle.Double;

            for (int i = 0; i < 50; i++)
            {
                control1.Items.Add(string.Format("Item {0}", i + 1));
            }

            screen.Controls.Add(control1);

            var textBox = new TextBox();
            textBox.BorderStyle = BorderStyle.Double;
            textBox.Width = 8;
            textBox.Left = (screen.Width / 2) - (textBox.Width / 2);
            textBox.Top = (screen.Height / 2) - (textBox.Height / 2);
            textBox.MaxLength = 6;
            textBox.BackgroundColor = System.ConsoleColor.DarkGreen;
            textBox.Visible = false;

            screen.Controls.Add(textBox);

            screen.Footer.Text = screen.Name + ". Press C to popup a text box, enter or escape.";

            screens.Add(screen);

            control1.KeyPressed += (s, e) =>
            {
                if (e.Info.Key == System.ConsoleKey.C)
                {
                    textBox.Visible = true;
                    textBox.Focus();
                }
            };

            control1.Selected += (s, e) =>
            {
                screen.Footer.Text = control1.SelectedItem;
            };
        }
    }
}<commit_msg>Added leave event handler to the UI test harness.<commit_after>﻿using ConsoleUI;

namespace ConsoleApplication1
{
    internal static class KeyPressedEvents
    {
        internal static void SetupListBoxScreens(ScreenCollection screens)
        {
            ListBoxPopup(screens);
        }

        private static void ListBoxPopup(ScreenCollection screens)
        {
            var screen = new Screen("List Box Pop Up");

            var control1 = new ListBox();

            control1.Left = 0;
            control1.Top = 0;
            control1.Width = screen.Width; ;
            control1.Height = screen.Height - 1;
            control1.BorderStyle = BorderStyle.Double;

            for (int i = 0; i < 50; i++)
            {
                control1.Items.Add(string.Format("Item {0}", i + 1));
            }

            screen.Controls.Add(control1);

            var textBox = new TextBox();
            textBox.BorderStyle = BorderStyle.Double;
            textBox.Width = 8;
            textBox.Left = (screen.Width / 2) - (textBox.Width / 2);
            textBox.Top = (screen.Height / 2) - (textBox.Height / 2);
            textBox.MaxLength = 6;
            textBox.BackgroundColor = System.ConsoleColor.DarkGreen;
            textBox.Visible = false;

            screen.Controls.Add(textBox);

            screen.Footer.Text = screen.Name + ". Press C to popup a text box, enter or escape.";

            screens.Add(screen);

            control1.KeyPressed += (s, e) =>
            {
                if (e.Info.Key == System.ConsoleKey.C)
                {
                    textBox.Visible = true;
                    textBox.Focus();
                }
            };

            control1.Selected += (s, e) =>
            {
                screen.Footer.Text = control1.SelectedItem;
            };

            textBox.Leave += (s, e) =>
            {
                screen.Footer.Text = textBox.Text;
            };
        }
    }
}
{'fraction_non_alphanumeric': 0.10466348701642819, 'fraction_numerical': 0.01377848436671966, 'mean_word_length': 1.3968253968253967, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, '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': '2963690', 'n_tokens_mistral': 1057, 'n_tokens_neox': 988, 'n_words': 223}