Improve diff display (anti-aliasing for conflict view and incomplete drawing of diff border)#9002
Conversation
…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.
|
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. |
eirikbakke
left a comment
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
@matthiasblaesing nitpick: let's only use comments when necessary
There was a problem hiding this comment.
This is a whitespace edit only.
There was a problem hiding this comment.
@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.
ide/diff/src/org/netbeans/modules/diff/builtin/visualizer/editable/LineNumbersActionsBar.java
Show resolved
Hide resolved
| dim.width = getWidthDimension(); | ||
| dim.height = getHeightDimension(); | ||
| // enlarge the gutter so that inserting new lines into | ||
| // enlarge the gutter so that inserting new lines into |
There was a problem hiding this comment.
@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. |
This changeset introduces two improvements to the diff view.