Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Prigogin2012-03-20 04:36:06 -0400
committerSergey Prigogin2012-03-20 04:38:30 -0400
commit01162459616d26ed9ba1ecbb3870873db58c8b9b (patch)
tree6a67683b17317b87ebf9d64ace6ed0aecefec6ee /core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite
parentf329b641feeb31baa20e23eda3303d7095cfd7ec (diff)
downloadorg.eclipse.cdt-01162459616d26ed9ba1ecbb3870873db58c8b9b.tar.gz
org.eclipse.cdt-01162459616d26ed9ba1ecbb3870873db58c8b9b.tar.xz
org.eclipse.cdt-01162459616d26ed9ba1ecbb3870873db58c8b9b.zip
Fixed excessive code reformatting.
Diffstat (limited to 'core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite')
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ChangeGenerator.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ChangeGenerator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ChangeGenerator.java
index f8a07a9b3e..3fe5980621 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ChangeGenerator.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ChangeGenerator.java
@@ -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;

Back to the top