private void ClearHighlighting() { var selectedRange = InputTextBox.Selection; var visibleRange = InputTextBox.VisibleRange; var firstVisibleLine = Math.Min(visibleRange.Start.iLine, visibleRange.End.iLine); var txt = InputTextBox.Text; InputTextBox.Clear(); InputTextBox.Text = txt; //remove all old highlighting InputTextBox.SetVisibleState(firstVisibleLine, FastColoredTextBoxNS.VisibleState.Visible); InputTextBox.Selection = selectedRange; }