From 8b0e452ef02579e75125268789f6ce264d2851c8 Mon Sep 17 00:00:00 2001 From: Andre Weinand Date: Mon, 9 May 2005 11:24:04 +0000 Subject: more work on #93901: Applying patch with one line added inserts new line one line above --- .../compare/org/eclipse/compare/internal/patch/Patcher.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bundles/org.eclipse.compare/plugins') 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; -- cgit v1.2.1