private async void SearchTextBox_TextChanged(object sender, TextChangedEventArgs e)
        {
            // Skip default
            if (SearchTextBox.Text == "" || SearchTextBox.Text == App.DefaultTextboxText)
            {
                return;
            }

            // If InterfaceOption.ExtendedFunctions is enabled and we have selected web mode then don't do anything here
            if ((interfaceOption & InterfaceOption.ExtendedFunctions) == InterfaceOption.ExtendedFunctions && SearchModeComboBox.SelectedIndex == 1)
            {
                return;                                                                                                                                     // Don't do anything
            }
            // Do search depending on current setting
            Triplet <List <ClueFragment>, List <Document>, FormatIndicator> triplet = await SearchTextBox_TextChangedDoSeaerch();

            // Retrive return values
            List <ClueFragment> nextClues       = triplet.Key;
            List <Document>     foundDocuments  = triplet.Value;
            FormatIndicator     formatIndicator = triplet.Tag;

            // Set up return results
            ClueFragmentSelectionpane.ItemsSource = nextClues;
            DocumentSelectionPane.ItemsSource     = foundDocuments;

            // Validation: If ShowValidationSymbol is enabled then show whether we find anything
            if ((interfaceOption & InterfaceOption.ShowValidationSymbol) == InterfaceOption.ShowValidationSymbol)
            {
                if (foundDocuments != null && foundDocuments.Count > 0)
                {
                    ValidationSymbolText.Content = "✓";

                    // Also display format indicator of current input format in tooltip when it's a tick
                    switch (formatIndicator)
                    {
                    case FormatIndicator.ID:
                        ValidationSymbolText.ToolTip = "Perform a search using ID";
                        break;

                    case FormatIndicator.Constrained:
                        ValidationSymbolText.ToolTip = "Perform a search using constraints";
                        break;

                    case FormatIndicator.SimpleClue:
                        ValidationSymbolText.ToolTip = "Perform a search using simple clue format";
                        break;

                    case FormatIndicator.Ambiguous:
                        ValidationSymbolText.ToolTip = "Perform an ambiguous serach";
                        break;

                    case FormatIndicator.Initiation:
                        ValidationSymbolText.ToolTip = "Initializing a search";
                        break;

                    default:
                        ValidationSymbolText.ToolTip = "Unrecognized format";
                        break;
                    }
                }
                else
                {
                    ValidationSymbolText.Content = "!";
                }
            }

            // Show search popup
            SearchPopup.IsOpen = true;
        }
        private async void SearchTextBox_TextChanged(object sender, TextChangedEventArgs e)
        {
            //<Development> Consider porting Web mode with Lightning's recent urls to boost usability

            // Skip default
            if (SearchTextBox.Text == "" || SearchTextBox.Text == App.DefaultTextboxText)
            {
                return;
            }

            // If InterfaceOption.ExtendedFunctions is enabled and we have selected web mode then don't do anything here
            if ((InterfaceOption & InterfaceOption.ExtendedFunctions) == InterfaceOption.ExtendedFunctions && ComboBoxSelection == SearchComboBoxEnum.Web)
            {
                return;                                                                                                                                            // Don't do anything
            }
            // Select only the line current cursor in on for search (e.g. in case of multiline)
            // Ref: https://stackoverflow.com/questions/17909651/c-sharp-get-cursor-line-in-richtextbox
            // Ref: https://stackoverflow.com/questions/31651305/how-to-get-textboxs-line-from-mouse-position
            string searchString = string.Empty;

            try
            {
                int lineIndex = SearchTextBox.GetLineIndexFromCharacterIndex(SearchTextBox.CaretIndex);
                if (lineIndex == -1)
                {
                    return;
                }
                searchString = SearchTextBox.GetLineText(lineIndex);
            }
            catch (Exception) { return; }
            if (string.IsNullOrWhiteSpace(searchString))
            {
                return;
            }

            // Do search depending on current setting
            Triplet <List <ClueFragment>, List <Document>, FormatIndicator> triplet = await Task.Run(() => SearchTextBox_TextChangedDoSeaerch(searchString));

            // Retrive return values
            List <ClueFragment> nextClues       = triplet.Key;
            List <Document>     foundDocuments  = triplet.Value;
            FormatIndicator     formatIndicator = triplet.Tag;

            // Set up return results
            if (nextClues != null)
            {
                for (int i = 0; i < nextClues.Count; i++)
                {
                    if (i < 10)
                    {
                        nextClues[i].Index = "F" + (i + 1); // Use functional keys to quickly select a suggested clue
                    }
                    else
                    {
                        nextClues[i].Index = string.Empty;
                    }
                }
            }
            ClueFragmentSelectionpane.ItemsSource = nextClues;
            DocumentSelectionPane.ItemsSource     = foundDocuments;

            // Validation: If ShowValidationSymbol is enabled then show whether we find anything
            if ((InterfaceOption & InterfaceOption.ShowValidationSymbol) == InterfaceOption.ShowValidationSymbol)
            {
                if (foundDocuments != null && foundDocuments.Count > 0)
                {
                    ValidationSymbolText.Content = "✓";

                    // Also display format indicator of current input format in tooltip when it's a tick
                    switch (formatIndicator)
                    {
                    case FormatIndicator.ID:
                        ValidationSymbolText.ToolTip = "Perform a search using ID";
                        break;

                    case FormatIndicator.Constrained:
                        ValidationSymbolText.ToolTip = "Perform a search using constraints";
                        break;

                    case FormatIndicator.SimpleClue:
                        ValidationSymbolText.ToolTip = "Perform a search using simple clue format";
                        break;

                    case FormatIndicator.Ambiguous:
                        ValidationSymbolText.ToolTip = "Perform an ambiguous serach";
                        break;

                    case FormatIndicator.Initiation:
                        ValidationSymbolText.ToolTip = "Initializing a search";
                        break;

                    default:
                        ValidationSymbolText.ToolTip = "Unrecognized format";
                        break;
                    }
                }
                else
                {
                    ValidationSymbolText.Content = "!";
                }
            }
        }