private string GetUrlAtPosition(int position) { // Determine whether the specified position is on our 'URL indicator' // and if so whether it is a valid URL. var urlIndicator = m_rScintilla_TextArea.Indicators[0]; var bitmapFlag = (1 << urlIndicator.Index); var bitmap = m_rScintilla_TextArea.IndicatorAllOnFor(position); var hasUrlIndicator = ((bitmapFlag & bitmap) == bitmapFlag); if (hasUrlIndicator) { var startPos = urlIndicator.Start(position); var endPos = urlIndicator.End(position); var text = m_rScintilla_TextArea.GetTextRange(startPos, endPos - startPos).Trim(); if (Uri.IsWellFormedUriString(text, UriKind.Absolute)) { return(text); } } return(null); }