IDEA-67496 Regression: Reformat on paste: Indent Block is not working when clipboard starts with comment Corrected processing in situation when pasted text ends with empty line

Corrected whole plain text replacement
This commit is contained in:
Denis.Zhdanov
2011-08-01 11:59:52 +04:00
parent 38386c1307
commit 4db548424d
2 changed files with 21 additions and 4 deletions
@@ -443,6 +443,26 @@ line to paste #1
doTest(before, toPaste, expected, TestFileType.TEXT)
}
def testPlainTextPasteWithCompleteReplacement() {
def before = '''\
<selection> line1
line2</selection>\
'''
def toPaste =
'''\
line to paste #1
line to paste #2
'''
def expected = '''\
line to paste #1
line to paste #2
'''
doTest(before, toPaste, expected, TestFileType.TEXT)
}
def doTest(before, toPaste, expected, fileType = TestFileType.JAVA) {
configureFromFileText("${getTestName(false)}.$fileType.extension", before)
@@ -342,11 +342,8 @@ public class PasteHandler extends EditorActionHandler {
Arrays.fill(fill, ' ');
String indentString = new String(fill);
for (
for (; linesToAdjustIndent > 0; linesToAdjustIndent--) {
int lineStartOffset = document.getLineStartOffset(++line);
linesToAdjustIndent > 0;
lineStartOffset = document.getLineStartOffset(++line), linesToAdjustIndent--)
{
document.insertString(lineStartOffset, indentString);
}
}