mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
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:
+20
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user