Permalink
Browse files

also check if at beginning of document

  • Loading branch information...
1 parent 4e8a0a9 commit 5e15633f9bb340d34b55a89d480ced38565cd951 @Shazbot Shazbot committed Mar 17, 2013
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/MarkPad/Document/EditorBehaviours/PasteURLIntoDocument.cs
@@ -25,7 +25,7 @@ public void Handle(EditorPreviewKeyDownEvent e)
var match = URLInTextRegex.Match(pastedText);
if (!match.Success) return;
- if ((e.Editor.SelectionStart + e.Editor.SelectionLength) != e.Editor.Document.TextLength) // check if at end of document
+ if (e.Editor.SelectionStart != 0 && (e.Editor.SelectionStart + e.Editor.SelectionLength) != e.Editor.Document.TextLength) // check if at beginning or end of document
{
if (e.Editor.Document.GetCharAt(e.Editor.SelectionStart - 1) == '[' && e.Editor.Document.GetCharAt(e.Editor.SelectionStart + e.Editor.SelectionLength) == ']')
{

0 comments on commit 5e15633

Please sign in to comment.