IDEA-98684 Setting a breakpoint via mouse also places the caret in this line

This commit is contained in:
Denis.Zhdanov
2013-02-14 20:31:06 +04:00
parent b2c4fbb939
commit cac022e77f
@@ -5435,8 +5435,15 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
final int oldStart = mySelectionModel.getSelectionStart();
final int oldEnd = mySelectionModel.getSelectionEnd();
moveCaretToScreenPos(x, y);
// Don't move caret on mouse press above gutter line markers area (a place where break points, 'override', 'implements' etc icons
// are drawn) and annotations area. E.g. we don't want to change caret position if a user sets new break point (clicks
// at 'line markers' area).
if (e.getSource() != myGutterComponent
|| (eventArea != EditorMouseEventArea.LINE_MARKERS_AREA && eventArea != EditorMouseEventArea.ANNOTATIONS_AREA))
{
moveCaretToScreenPos(x, y);
}
if (e.isPopupTrigger()) return isNavigation;
@@ -5486,11 +5493,10 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
}
else {
int startToUse = oldSelectionStart;
int endToUse = caretOffset;
if (mySelectionModel.isUnknownDirection() && caretOffset > startToUse) {
startToUse = Math.min(oldStart, oldEnd);
}
mySelectionModel.setSelection(startToUse, endToUse);
mySelectionModel.setSelection(startToUse, caretOffset);
}
}
else {