Skip to content

Improve diff display (anti-aliasing for conflict view and incomplete drawing of diff border)#9002

Merged
matthiasblaesing merged 3 commits intoapache:masterfrom
matthiasblaesing:diff_display
Nov 22, 2025
Merged

Improve diff display (anti-aliasing for conflict view and incomplete drawing of diff border)#9002
matthiasblaesing merged 3 commits intoapache:masterfrom
matthiasblaesing:diff_display

Conversation

@matthiasblaesing
Copy link
Contributor

This changeset introduces two improvements to the diff view.

  1. The anti-aliasing settings are now also applied to the conflict resolver UI. The top part of the screenshot show the base state, the lower part the new state. Only the line number change their appearance. Bildschirmfoto vom 2025-11-10 19-29-45
  2. In the diff view hovering over the action icon causes the delimiting line of the line change to be partially drawn: Bildschirmfoto vom 2025-11-10 20-44-46. In the screenshot the relevant part is the half drawn line above the "x" icon in line 48, right side.

…er icon

The LineNumbersActionsBar is used in the diff views it is the component
placed between the editor panes on both sides of the divider and the
divider. The component provides the "remove" and "add" line actions,
that allow users to align checked out state with the reference revision.

+--------------+-----------------------------------+
| Editor 1     |LNAB1 | DIV | LNBA2 |     Editor 2 |
|              |      |     |       |              |
+--------------+------+-----+-------+--------------+

Editor => Editor Pane
LNAB   => LineNumbersActionsBar
DIV    => Divider

The LineNumbersActionsBar itself is roughly (right side drawn below,
left side is inversed):

+----+----+
| LN | AI |
+----+----+

LN => LineNumber
AI => ActionIcon

The ActionIcon is redrawn when the mouse enters and exists its active
area. When that happens, the surrounding line is only partially drawn.

The problem is the usage of the clip rectangle. The two lines above and
below the action icon, that surround the individual diff entries were
drawn using the the values 0 and clip.width for the x coordinates of
the line. That works ok, when the full width is drawn, but fails in the
hover case.

This is the clip rectangle from a normal scroll:

    "java.awt.Rectangle[x=0,y=1546,width=48,height=102]"

And this from the hover:

    "java.awt.Rectangle[x=33,y=799,width=15,height=16]"

There is no need to redraw the whole area when just the action icon
changes state and in this case the drawn line is to short.

There is actually no reason to use the clip rectangle at this point.
The x coordinates are known. The line starts at the beginning (0) and
should be drawn over the whole width (barWidth). The drawing
architecture will clip correctly, we don't need to optimize here.
@matthiasblaesing matthiasblaesing added this to the NB29 milestone Nov 10, 2025
@matthiasblaesing matthiasblaesing added UI User Interface ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) labels Nov 10, 2025
@matthiasblaesing
Copy link
Contributor Author

For review I suggest to look at the individual diffs. The biggest part of changes was caused by fixing/removing warnings NetBeans generated for the files. These changes were separated from the bugfix changes.

Copy link
Contributor

@eirikbakke eirikbakke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for this!

dim.width = getWidthDimension();
dim.height = getHeightDimension();
// enlarge the gutter so that inserting new lines into
// enlarge the gutter so that inserting new lines into

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@matthiasblaesing nitpick: let's only use comments when necessary

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a whitespace edit only.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eirikbakke The PR is larger than needed due to formatting changes in unrelated sections. Please limit edits to only the necessary functional changes to avoid cascading reformatting by future contributors.

cc @matthiasblaesing

dim.width = getWidthDimension();
dim.height = getHeightDimension();
// enlarge the gutter so that inserting new lines into
// enlarge the gutter so that inserting new lines into

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eirikbakke The PR is larger than needed due to formatting changes in unrelated sections. Please limit edits to only the necessary functional changes to avoid cascading reformatting by future contributors.

cc @matthiasblaesing

@matthiasblaesing
Copy link
Contributor Author

@eirikbakke The PR is larger than needed due to formatting changes in unrelated sections. Please limit > edits to only the necessary functional changes to avoid cascading reformatting by future contributors.

@donphelix I don't see the problem. The commit message is pretty clear why the commit exists. The changes I made throughout the file are general cleanup and in that case I also routinely remove trailing unncessary whitespace. I don't see conflict potential with other contributors, unless the next editor reapplies the unnessary whitespace.

@matthiasblaesing matthiasblaesing merged commit 5c23479 into apache:master Nov 22, 2025
30 checks passed
@matthiasblaesing matthiasblaesing deleted the diff_display branch November 27, 2025 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) UI User Interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants