protected void SetHighlightFormat(int index)
        {
            lastSelection = hudChain[index];
            ITextBoard textBoard = lastSelection.Element.TextBoard;

            lastFormat = textBoard.Format;
            textBoard.SetFormatting(textBoard.Format.WithColor(FocusTextColor));
        }
        protected void SetFocusFormat(int index)
        {
            var        selection = hudChain[index];
            ITextBoard textBoard = selection.Element.TextBoard;

            lastSelection.Item1 = selection;
            lastSelection.Item2 = textBoard.Format;

            textBoard.SetFormatting(textBoard.Format.WithColor(FocusTextColor));
        }
        /// <summary>
        /// Updates text box formatting in response to input from the toolbar
        /// </summary>
        private void ChangeFormat()
        {
            ITextBoard textBoard = textBox.text.TextBoard;

            textBoard.Format = toolBar.Format;

            // Apply new formatting to selected text range. This will completely overwrite the text
            // formatting of the selected range. Modifying it to only apply the last effect/setting
            // used would require setting formatting per-character. I should probably add a function
            // for that in the future, probably using some kind of bit mask.
            if (!textBox.text.SelectionEmpty)
            {
                textBoard.SetFormatting(textBox.text.SelectionStart, textBox.text.SelectionEnd, toolBar.Format);
            }
        }
        protected virtual void UpdateSelectionFormatting()
        {
            if (lastSelection.Item1 != null)
            {
                ITextBoard textBoard = lastSelection.Item1.Element.TextBoard;
                textBoard.SetFormatting(lastSelection.Item2);
                lastSelection.Item1 = null;
            }

            if ((SelectionIndex == listInput.FocusIndex) && SelectionIndex != -1)
            {
                if (
                    (listInput.KeyboardScroll ^ (SelectionIndex != listInput.HighlightIndex)) ||
                    (!MouseInput.IsMousedOver && SelectionIndex == listInput.HighlightIndex)
                    )
                {
                    if (hudChain[listInput.SelectionIndex].AllowHighlighting)
                    {
                        SetFocusFormat(listInput.SelectionIndex);
                        selectionBox.Color = FocusColor;
                    }
                }
                else
                {
                    selectionBox.Color = HighlightColor;
                }

                highlightBox.Color = HighlightColor;
            }
            else
            {
                if (listInput.KeyboardScroll)
                {
                    if (hudChain[listInput.HighlightIndex].AllowHighlighting)
                    {
                        SetFocusFormat(listInput.HighlightIndex);
                        highlightBox.Color = FocusColor;
                    }
                }
                else
                {
                    highlightBox.Color = HighlightColor;
                }

                selectionBox.Color = HighlightColor;
            }
        }