Lines 1061-1066
Link Here
|
1061 |
TextEdit sourceEdit= getCopySourceEdit(copySource); |
1061 |
TextEdit sourceEdit= getCopySourceEdit(copySource); |
1062 |
doTextCopy(sourceEdit, insertOffset, srcIndentLevel, destIndentString, editGroup); |
1062 |
doTextCopy(sourceEdit, insertOffset, srcIndentLevel, destIndentString, editGroup); |
1063 |
currPos= offset + curr.length; // continue to insert after the replaced string |
1063 |
currPos= offset + curr.length; // continue to insert after the replaced string |
|
|
1064 |
if (needsNewLineForLineComment(copySource.getNode(), formatted, currPos)) { |
1065 |
doTextInsert(insertOffset, getLineDelimiter(), editGroup); |
1066 |
} |
1064 |
} else if (data instanceof StringPlaceholderData) { // replace with a placeholder |
1067 |
} else if (data instanceof StringPlaceholderData) { // replace with a placeholder |
1065 |
String code= ((StringPlaceholderData) data).code; |
1068 |
String code= ((StringPlaceholderData) data).code; |
1066 |
String str= this.formatter.changeIndent(code, 0, destIndentString); |
1069 |
String str= this.formatter.changeIndent(code, 0, destIndentString); |
Lines 1076-1081
Link Here
|
1076 |
} |
1079 |
} |
1077 |
} |
1080 |
} |
1078 |
|
1081 |
|
|
|
1082 |
private boolean needsNewLineForLineComment(ASTNode node, String formatted, int offset) { |
1083 |
if (!this.lineCommentEndOffsets.isEndOfLineComment(getExtendedEnd(node), this.content)) { |
1084 |
return false; |
1085 |
} |
1086 |
// copied code ends with a line comment, but doesn't contain the new line |
1087 |
return offset < formatted.length() && !IndentManipulation.isLineDelimiterChar(formatted.charAt(offset)); |
1088 |
} |
1089 |
|
1079 |
private String getCurrentLine(String str, int pos) { |
1090 |
private String getCurrentLine(String str, int pos) { |
1080 |
for (int i= pos - 1; i>= 0; i--) { |
1091 |
for (int i= pos - 1; i>= 0; i--) { |
1081 |
char ch= str.charAt(i); |
1092 |
char ch= str.charAt(i); |