File tree Expand file tree Collapse file tree
ICSharpCode.AvalonEdit/Editing Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -644,11 +644,11 @@ void ExtendSelectionToMouse(MouseEventArgs e)
644644 textArea . Selection = Selection . Create ( textArea ,
645645 Math . Min ( newWord . Offset , startWord . Offset ) ,
646646 Math . Max ( newWord . EndOffset , startWord . EndOffset ) ) ;
647- // Set caret offset, but limit the caret to stay inside the selection.
648- // in whole-word selection, it's otherwise possible that we get the caret outside the
649- // selection - but the TextArea doesn't like that and will reset the selection, causing
650- // flickering.
651- SetCaretOffsetToMousePosition ( e , textArea . Selection . SurroundingSegment ) ;
647+ // moves caret to start or end of selection
648+ if ( newWord . Offset < startWord . Offset )
649+ textArea . Caret . Offset = newWord . Offset ;
650+ else
651+ textArea . Caret . Offset = Math . Max ( newWord . EndOffset , startWord . EndOffset ) ;
652652 }
653653 }
654654 textArea . Caret . BringCaretToView ( 5.0 ) ;
You can’t perform that action at this time.
0 commit comments