Skip to content

Commit 9921398

Browse files
StyledText#setLineVerticalIndent: fix overlapping code minings in editor
Ensure problem annotation code minings are rendered below source lines to prevent visual overlap during vertical scrolling. Fixes: #2512
1 parent 508ad4a commit 9921398

File tree

1 file changed

+25
-19
lines changed
  • bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom

1 file changed

+25
-19
lines changed

bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9330,27 +9330,33 @@ public void setLineVerticalIndent(int lineIndex, int verticalLineIndent) {
93309330
if (verticalScrollbar != null) {
93319331
verticalScrollbar.setMaximum(verticalScrollbar.getMaximum() + verticalIndentDiff);
93329332
}
9333-
} else {
9334-
resetCache(lineIndex, 1);
9335-
if((initialTopIndex == 0) && (initialBottomIndex == (content.getLineCount() - 1))) { // not scrollable editor
9336-
setCaretLocations();
9337-
redrawLines(lineIndex, getBottomIndex() - lineIndex + 1, true);
9338-
} else if (getFirstCaretLine() >= initialTopIndex && getFirstCaretLine() <= initialBottomIndex) { // caret line with caret mustn't move
9339-
if (getFirstCaretLine() < lineIndex) {
9340-
redrawLines(lineIndex, getPartialBottomIndex() - lineIndex + 1, true);
9341-
} else {
9342-
setTopPixel(initialTopPixel + verticalIndentDiff);
9343-
}
9344-
} else { // move as few lines as possible
9345-
if (lineIndex - getTopIndex() < getBottomIndex() - lineIndex) {
9346-
setTopPixel(initialTopPixel + verticalIndentDiff);
9347-
} else {
9348-
// redraw below
9349-
redrawLines(lineIndex, getPartialBottomIndex() - lineIndex + 1, true);
9350-
}
9333+
}
9334+
redrawLines(lineIndex, initialTopIndex, initialBottomIndex, initialTopPixel, verticalIndentDiff);
9335+
}
9336+
9337+
private void redrawLines(int lineIndex, int initialTopIndex, int initialBottomIndex, int initialTopPixel,
9338+
int verticalIndentDiff) {
9339+
resetCache(lineIndex, 1);
9340+
if ((initialTopIndex == 0) && (initialBottomIndex == (content.getLineCount() - 1))) { // not scrollable editor
9341+
setCaretLocations();
9342+
redrawLines(lineIndex, getBottomIndex() - lineIndex + 1, true);
9343+
} else if (getFirstCaretLine() >= initialTopIndex && getFirstCaretLine() <= initialBottomIndex) { // caret line with
9344+
// caret mustn't
9345+
// move
9346+
if (getFirstCaretLine() < lineIndex) {
9347+
redrawLines(lineIndex, getPartialBottomIndex() - lineIndex + 1, true);
9348+
} else {
9349+
setTopPixel(initialTopPixel + verticalIndentDiff);
9350+
}
9351+
} else { // move as few lines as possible
9352+
if (lineIndex - getTopIndex() < getBottomIndex() - lineIndex) {
9353+
setTopPixel(initialTopPixel + verticalIndentDiff);
9354+
} else {
9355+
// redraw below
9356+
redrawLines(lineIndex, getPartialBottomIndex() - lineIndex + 1, true);
93519357
}
9352-
setScrollBars(true);
93539358
}
9359+
setScrollBars(true);
93549360
}
93559361

93569362
/**

0 commit comments

Comments
 (0)