/// <summary>
/// Selects the specified text range.
/// </summary>
static void SelectText(SelectionManager selectionManager, IDocument document, int startOffset, int length)
{
selectionManager.ClearSelection();
TextLocation selectionStart = document.OffsetToPosition(startOffset);
TextLocation selectionEnd = document.OffsetToPosition(startOffset + length);
selectionManager.SetSelection(selectionStart, selectionEnd);
}