Merge branch 'master' of git.labs.intellij.net:idea/community

This commit is contained in:
Bas Leijdekkers
2011-10-17 15:31:57 +02:00
3 changed files with 26 additions and 1 deletions
@@ -55,6 +55,11 @@ public class FragmentSeparatorsPositionConsumer {
return myRight;
}
public void clear() {
myLeft.clear();
myRight.clear();
}
public static class TornSeparator {
private final int myLeftLine;
private final int myRightLine;
@@ -92,6 +92,7 @@ public class FragmentedDiffPanelState extends DiffPanelState {
public LineBlocks updateEditors() throws FilesTooBigForDiffException {
resetMarkup();
mySeparatorsPositionConsumer.clear();
if (myAppender1.getEditor() == null || myAppender2.getEditor() == null) {
return LineBlocks.EMPTY;
}
@@ -179,13 +179,32 @@ public class TextPatchBuilder {
}
}
}
checkPathEndLine(patch, c.getAfter());
} else if (! beforeRevision.getPath().equals(afterRevision.getPath())) {
result.add(buildMovedFile(myBasePath, beforeRevision, afterRevision, beforeLines));
final TextFilePatch movedPatch = buildMovedFile(myBasePath, beforeRevision, afterRevision, beforeLines);
checkPathEndLine(movedPatch, c.getAfter());
result.add(movedPatch);
}
}
return result;
}
private void checkPathEndLine(TextFilePatch filePatch, final AirContentRevision cr) throws VcsException {
if (cr == null) return;
if (filePatch.isDeletedFile() || filePatch.getAfterName() == null) return;
final List<PatchHunk> hunks = filePatch.getHunks();
if (hunks.isEmpty()) return;
final PatchHunk hunk = hunks.get(hunks.size() - 1);
final List<PatchLine> lines = hunk.getLines();
if (lines.isEmpty()) return;
final String contentAsString = cr.getContentAsString();
if (contentAsString == null) return;
if (! contentAsString.endsWith("\n")) {
lines.get(lines.size() - 1).setSuppressNewLine(true);
}
}
private static String[] tokenize(String text) {
return text.length() == 0 ? new String[]{text} : new LineTokenizer(text).execute();
}