mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
diff: cleanup
This commit is contained in:
@@ -57,16 +57,16 @@ public class DiffLineMarkerRenderer implements LineMarkerRendererEx {
|
||||
int x1 = 0;
|
||||
int x2 = x1 + gutter.getWidth();
|
||||
|
||||
int y, height;
|
||||
int y1, y2;
|
||||
if (myEmptyRange && myLastLine) {
|
||||
y = DiffDrawUtil.lineToY(editor, DiffUtil.getLineCount(editor.getDocument()));
|
||||
height = 0;
|
||||
y1 = DiffDrawUtil.lineToY(editor, DiffUtil.getLineCount(editor.getDocument()));
|
||||
y2 = y1;
|
||||
}
|
||||
else {
|
||||
int startLine = editor.getDocument().getLineNumber(myHighlighter.getStartOffset());
|
||||
int endLine = editor.getDocument().getLineNumber(myHighlighter.getEndOffset()) + 1;
|
||||
y = DiffDrawUtil.lineToY(editor, startLine);
|
||||
height = myEmptyRange ? 0 : DiffDrawUtil.lineToY(editor, endLine) - y;
|
||||
y1 = DiffDrawUtil.lineToY(editor, startLine);
|
||||
y2 = myEmptyRange ? y1 : DiffDrawUtil.lineToY(editor, endLine);
|
||||
}
|
||||
|
||||
if (myHideWithoutLineNumbers && !editor.getSettings().isLineNumbersShown()) {
|
||||
@@ -76,45 +76,44 @@ public class DiffLineMarkerRenderer implements LineMarkerRendererEx {
|
||||
int annotationsOffset = gutter.getAnnotationsAreaOffset();
|
||||
int annotationsWidth = gutter.getAnnotationsAreaWidth();
|
||||
if (annotationsWidth != 0) {
|
||||
drawMarker(editor, g2, x1, annotationsOffset, y, height, false);
|
||||
drawMarker(editor, g2, x1, annotationsOffset, y1, y2, false);
|
||||
x1 = annotationsOffset + annotationsWidth;
|
||||
}
|
||||
}
|
||||
|
||||
if (myIgnoredFoldingOutline) {
|
||||
int xOutline = gutter.getWhitespaceSeparatorOffset();
|
||||
drawMarker(editor, g2, xOutline, x2, y, height, true);
|
||||
drawMarker(editor, g2, x1, xOutline, y, height, false);
|
||||
} else {
|
||||
drawMarker(editor, g2, x1, x2, y, height, false);
|
||||
drawMarker(editor, g2, xOutline, x2, y1, y2, true);
|
||||
drawMarker(editor, g2, x1, xOutline, y1, y2, false);
|
||||
}
|
||||
else {
|
||||
drawMarker(editor, g2, x1, x2, y1, y2, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawMarker(Editor editor, Graphics2D g2,
|
||||
int x1, int x2, int y, int height,
|
||||
boolean ignoredOutline) {
|
||||
int x1, int x2, int y1, int y2,
|
||||
boolean ignoredBackgroundColor) {
|
||||
if (x1 >= x2) return;
|
||||
|
||||
Color color = myDiffType.getColor(editor);
|
||||
if (height > 2) {
|
||||
if (ignoredOutline) {
|
||||
g2.setColor(myDiffType.getIgnoredColor(editor));
|
||||
if (y2 - y1 > 2) {
|
||||
if (!myResolved) {
|
||||
g2.setColor(ignoredBackgroundColor ? myDiffType.getIgnoredColor(editor) : color);
|
||||
g2.fillRect(x1, y1, x2 - x1, y2 - y1);
|
||||
}
|
||||
else {
|
||||
g2.setColor(color);
|
||||
}
|
||||
if (!myResolved) g2.fillRect(x1, y, x2 - x1, height);
|
||||
|
||||
DiffDrawUtil.drawChunkBorderLine(g2, x1, x2, y - 1, color, false, myResolved);
|
||||
DiffDrawUtil.drawChunkBorderLine(g2, x1, x2, y + height - 1, color, false, myResolved);
|
||||
DiffDrawUtil.drawChunkBorderLine(g2, x1, x2, y1 - 1, color, false, myResolved);
|
||||
DiffDrawUtil.drawChunkBorderLine(g2, x1, x2, y2 - 1, color, false, myResolved);
|
||||
}
|
||||
else {
|
||||
// range is empty - insertion or deletion
|
||||
// Draw 2 pixel line in that case
|
||||
DiffDrawUtil.drawChunkBorderLine(g2, x1, x2, y - 1, color, true, myResolved);
|
||||
DiffDrawUtil.drawChunkBorderLine(g2, x1, x2, y1 - 1, color, true, myResolved);
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Position getPosition() {
|
||||
return Position.CUSTOM;
|
||||
|
||||
Reference in New Issue
Block a user