void () { CodeInsightSettings settings = CodeInsightSettings.getInstance(); int oldValue = settings.REFORMAT_ON_PASTE; settings.REFORMAT_ON_PASTE = CodeInsightSettings.INDENT_BLOCK; try { doTest(PlainTextFileType.INSTANCE, () -> { // Move caret to the non-zero column. getEditor().getCaretModel().moveToOffset(3); // Select all text. getEditor().getSelectionModel().setSelection(0, getEditor().getDocument().getTextLength()); // Perform 'copy-paste' action. Expecting to get the same file. copy(); paste(); }); } finally { settings.REFORMAT_ON_PASTE = oldValue; } }