CodeInsightTestFixtureImpl: reset caret position and selection on 'configure...'

This commit is contained in:
Dmitry Semeniouta
2013-09-30 21:43:22 +04:00
parent 9084737b07
commit a2f6e6560e
@@ -1343,10 +1343,9 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
assert myEditor != null : "Editor couldn't be created for file: " +
copy.getPath() +
", use copyFileToProject(..) method for this file instead of configureByFile(..)";
if (loader.caretMarker != null) {
int offset = loader.caretMarker.getStartOffset();
myEditor.getCaretModel().moveToOffset(offset);
}
int offset = loader.caretMarker != null ? loader.caretMarker.getStartOffset() : 0;
myEditor.getCaretModel().moveToOffset(offset);
if (loader.selStartMarker != null && loader.selEndMarker != null) {
int start = loader.selStartMarker.getStartOffset();
int end = loader.selEndMarker.getStartOffset();
@@ -1357,6 +1356,9 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
myEditor.getSelectionModel().setSelection(start, end);
}
}
else {
myEditor.getSelectionModel().removeSelection();
}
Module module = getModule();
if (module != null) {