private void continueSearch(bool forward) { if (TextSearch == null) { return; } int startPosition = 0; Control control = MostRecentFocusedDiscussionControl ?? ActiveControl; if (control is ITextControl textControl && textControl.HighlightState != null) { startPosition = forward ? textControl.HighlightState.HighlightStart + textControl.HighlightState.HighlightLength : textControl.HighlightState.HighlightStart; textControl.ClearHighlight(); } TextSearchResult?result = forward ? TextSearch.FindNext(control, startPosition) : TextSearch.FindPrev(control, startPosition); if (result != null) { highlightSearchResult(result); } }