Skip to content

Commit cf1f7bd

Browse files
committed
[Compare] Show move-button marker for larger diffs with range connection
When comparing diffs with five or more lines, show the 'move'-button markers even when using range connections in order to assist the user in finding the move buttons, which only appear when hovering over them. For smaller diffs the marker is not shown to clutter the UI less as the markers are then relatively easy to find in the middle of the range. Follow-up on - #2565
1 parent c806698 commit cf1f7bd

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

team/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2025 IBM Corporation and others.
2+
* Copyright (c) 2000, 2026 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -4522,11 +4522,13 @@ private void paintCenter(Canvas canvas, GC g) {
45224522

45234523
fLeft.getLineRange(diff.getPosition(LEFT_CONTRIBUTOR), region);
45244524
region.x -= fLeft.getDocumentRegionOffset();
4525+
int diffLines = region.y;
45254526
int ly = getHeightBetweenLines(fLeft, 0, region.x) + lshift;
45264527
int lh = getHeightBetweenLines(fLeft, region.x, region.x + region.y);
45274528

45284529
fRight.getLineRange(diff.getPosition(RIGHT_CONTRIBUTOR), region);
45294530
region.x -= fRight.getDocumentRegionOffset();
4531+
diffLines = Math.max(diffLines, region.y);
45304532
int ry = getHeightBetweenLines(fRight, 0, region.x) + rshift;
45314533
int rh = getHeightBetweenLines(fRight, region.x, region.x + region.y);
45324534

@@ -4579,7 +4581,7 @@ private void paintCenter(Canvas canvas, GC g) {
45794581
}
45804582
}
45814583

4582-
if (fUseSingleLine && isAnySideEditable()) {
4584+
if ((fUseSingleLine || diffLines >= 5) && isAnySideEditable()) {
45834585
// draw resolve state
45844586
int cx= (w-RESOLVE_SIZE)/2;
45854587
int cy= ((ly+lh/2) + (ry+rh/2) - RESOLVE_SIZE)/2;

0 commit comments

Comments
 (0)