diff options
author | Andre Weinand | 2005-05-09 11:24:04 +0000 |
---|---|---|
committer | Andre Weinand | 2005-05-09 11:24:04 +0000 |
commit | 8b0e452ef02579e75125268789f6ce264d2851c8 (patch) | |
tree | bc90a59c86b39637c35e785c04a1d4ce39751b18 | |
parent | 131da3fefbe8e8a578a4b91768bd3c7af2a5c774 (diff) | |
download | eclipse.platform.team-8b0e452ef02579e75125268789f6ce264d2851c8.tar.gz eclipse.platform.team-8b0e452ef02579e75125268789f6ce264d2851c8.tar.xz eclipse.platform.team-8b0e452ef02579e75125268789f6ce264d2851c8.zip |
more work on #93901: Applying patch with one line added inserts new line one line above
2 files changed, 4 insertions, 4 deletions
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java index a459aad6b..dfa16c852 100644 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java +++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java @@ -255,7 +255,7 @@ public class Patcher { lines.add(line); continue; case '\\': - if (line.startsWith("No newline at end of file", 2)) { //$NON-NLS-1$ + if (line.indexOf("newline at end") > 0) { //$NON-NLS-1$ int lastIndex= lines.size(); if (lastIndex > 0) { line= (String) lines.get(lastIndex-1); @@ -268,7 +268,7 @@ public class Patcher { } else if (lc == '\r') { end--; } - line= line.substring(0, end); + line= line.substring(0, end+1); lines.set(lastIndex-1, line); } continue; diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java index a459aad6b..dfa16c852 100644 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java +++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java @@ -255,7 +255,7 @@ public class Patcher { lines.add(line); continue; case '\\': - if (line.startsWith("No newline at end of file", 2)) { //$NON-NLS-1$ + if (line.indexOf("newline at end") > 0) { //$NON-NLS-1$ int lastIndex= lines.size(); if (lastIndex > 0) { line= (String) lines.get(lastIndex-1); @@ -268,7 +268,7 @@ public class Patcher { } else if (lc == '\r') { end--; } - line= line.substring(0, end); + line= line.substring(0, end+1); lines.set(lastIndex-1, line); } continue; |