From 551f15d5d1de64eda1d30d15e3480d222646d4bc Mon Sep 17 00:00:00 2001 From: Christopher Hermann Date: Fri, 17 Jan 2025 09:24:57 +0100 Subject: [PATCH] [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 --- .../texteditor/stickyscroll/StickyScrollingControl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bundles/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/stickyscroll/StickyScrollingControl.java b/bundles/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/stickyscroll/StickyScrollingControl.java index 559fa1416de..b79afafa243 100644 --- a/bundles/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/stickyscroll/StickyScrollingControl.java +++ b/bundles/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/stickyscroll/StickyScrollingControl.java @@ -394,6 +394,9 @@ private void addSourceViewerListeners() { if (sourceViewer instanceof ITextViewerExtension4 extension) { textPresentationListener = e -> { Display.getDefault().asyncExec(() -> { + if (textWidget.isDisposed() || areStickyLinesOutDated(textWidget)) { + return; + } styleStickyLines(); }); };