From 04e9880fd0953fcec4b436acb2f6ef9d1acf9f66 Mon Sep 17 00:00:00 2001 From: "Denis.Zhdanov" Date: Wed, 7 Dec 2011 16:05:25 +0300 Subject: [PATCH] IDEA-77804 Incorrect indentation when pasting a line of Java code Don't skip trailing line feeds of the pasted content anymore because that can affect processing of subsequent block --- .../intellij/codeInsight/editorActions/PasteHandler.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/PasteHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/PasteHandler.java index cf58f40d2c16..4b65a2c9716c 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/PasteHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/PasteHandler.java @@ -323,12 +323,8 @@ public class PasteHandler extends EditorActionHandler implements EditorTextInser } private static void indentEachLine(Project project, Editor editor, int startOffset, int endOffset) { - Document document = editor.getDocument(); - CharSequence chars = document.getCharsSequence(); - endOffset = CharArrayUtil.shiftBackward(chars, endOffset - 1, "\n\r") + 1; - PsiDocumentManager.getInstance(project).commitAllDocuments(); - PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(document); + PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument()); CodeStyleManager codeStyleManager = CodeStyleManager.getInstance(project); try {