Files
openide/java/java-tests/testData/codeInsight/editing/beforeAutoWrapRightMargin.java
Dmitry Jemerov b7bf676d95 Extract Java-specific part out of EditingTest to java-tests module
GitOrigin-RevId: 4084abc5b1e62a69fc7d4adfce06a1734203f6f2
2022-05-02 16:17:39 +00:00

26 lines
817 B
Java

class Test {
public void testCopyPasteWithoutUnnecessaryIndent() throws Exception {
CodeInsightSettings settings = CodeInsightSettings.getInstance();
int oldValue = settings.REFORMAT_ON_PASTE;
settings.REFORMAT_ON_PASTE = CodeInsightSettings.INDENT_BLOCK;
try {
doTest(TestFileType.TEXT<caret>, new Runnable() {
@Override
public void run() {
// Move caret to the non-zero column.
myEditor.getCaretModel().moveToOffset(3);
// Select all text.
myEditor.getSelectionModel().setSelection(0, myEditor.getDocument().getTextLength());
// Perform 'copy-paste' action. Expecting to get the same file.
copy();
paste();
}
});
}
finally {
settings.REFORMAT_ON_PASTE = oldValue;
}
}
}