void () { for (int i = 0; i < 6; i++) { executeEditorAction(getFirstEditor(), IdeActions.ACTION_EDITOR_ENTER); } typeInChar('a'); try { myManager.setOverriddenEditorProvider(new CurrentEditorProvider() { @Override public @Nullable FileEditor getCurrentEditor(@Nullable Project project) { return null; } }); executeTransparentlyInWriteAction(() -> getFirstEditor().getDocument().insertString(0, " ")); } finally { myManager.setOverriddenEditorProvider(null); } executeEditorAction(getFirstEditor(), IdeActions.ACTION_EDITOR_TEXT_START); undo(getFirstEditor()); checkEditorText("\n\n\n\n\n\natest"); undo(getFirstEditor()); checkEditorText("\n\n\n\n\n\ntest"); }