fixed exception and inner function in copy-paste

This commit is contained in:
Ekaterina Tuzova
2012-07-04 12:47:46 +04:00
parent 4b98bf2c5c
commit 8e51362814
@@ -12,6 +12,7 @@ import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiFile;
import com.intellij.util.text.CharArrayUtil;
@@ -20,6 +21,7 @@ import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.io.IOException;
import java.util.List;
/**
* @author yole
@@ -147,7 +149,9 @@ public class CopyPasteIndentProcessor implements CopyPastePostProcessor<IndentTr
EditorActionUtil.indentLine(project, editor, startLine, -value.getFirstLineLeadingSpaces());
}
if (caretColumn > value.getIndent()) endLine -=1;
final List<String> strings = StringUtil.split(pastedText, "\n");
if (caretColumn > value.getIndent() && !strings.isEmpty() &&
StringUtil.isEmptyOrSpaces(strings.get(strings.size()-1))) endLine -=1;
for (int i = startLine+1; i <= endLine; i++) {
EditorActionUtil.indentLine(project, editor, i, value.getIndent());