mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' of git.labs.intellij.net:idea/community
This commit is contained in:
+5
@@ -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;
|
||||
|
||||
+1
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user