1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Fixed excessive code reformatting.

This commit is contained in:
Sergey Prigogin 2012-03-20 01:36:06 -07:00
parent f329b641fe
commit 0116245961
2 changed files with 7 additions and 3 deletions

View file

@ -345,8 +345,12 @@ public class ChangeGenerator extends ASTVisitor {
int offset = edit.getOffset();
int end = offset + edit.getLength();
int newOffset = document.getLineInformationOfOffset(offset).getOffset();
int newEnd = endOffset(document.getLineInformationOfOffset(end));
edit = originalEdits[i];
int originalEnd = edit.getExclusiveEnd();
// Expand to the end of the line unless the end of the edit region is at
// the beginning of line both, before and after the change.
int newEnd = (originalEnd == 0 || code.charAt(originalEnd - 1) == '\n') && end == newOffset ?
end : endOffset(document.getLineInformationOfOffset(end));
int offsetBefore = edit.getOffset();
int newOffsetBefore = newOffset + offsetBefore - offset;
int newEndBefore = newEnd + offsetBefore + edit.getLength() - end;

View file

@ -285,7 +285,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
//void main() {
// /*$*/A a("");
// a.m1();/*$$*/
// A b(a);
// A b(a); // nonstandard indent to check that it is preserved
//}
//====================
//class A {
@ -303,7 +303,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
//
//void main() {
// A a = extracted();
// A b(a);
// A b(a); // nonstandard indent to check that it is preserved
//}
public void testLocalVariableDeclaration_3() throws Exception {
assertRefactoringSuccess();