Skip to content

Commit 815c9c0

Browse files
Christopher-Hermanniloveeclipse
authored andcommitted
[StickyScrolling] Don't style outdated sticky lines
The search view with "reuse editor" enabled sets new source code in the existing editor and fires a extPresentation change event. In this call, it can happen that the sticky line number exceeds the amount of line in the new source code. In general this is not a problem since the sticky lines will be recalculated afterwards, but to avoid IllegalArgumentException it is checked for this case. Fixes #2678
1 parent 717ee0c commit 815c9c0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

bundles/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/stickyscroll/StickyScrollingControl.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,9 @@ private void addSourceViewerListeners() {
394394
if (sourceViewer instanceof ITextViewerExtension4 extension) {
395395
textPresentationListener = e -> {
396396
Display.getDefault().asyncExec(() -> {
397+
if (textWidget.isDisposed() || areStickyLinesOutDated(textWidget)) {
398+
return;
399+
}
397400
styleStickyLines();
398401
});
399402
};

0 commit comments

Comments
 (0)