From 4a4feb732caa05d5365878f7134be81af129d758 Mon Sep 17 00:00:00 2001 From: Ed Merks Date: Fri, 4 Oct 2024 11:28:54 +0200 Subject: [PATCH] ProjectionAnnotationModel.expandAll should tolerate the empty selection - ITextSelection.emptySelection has offset and length -1 so those values need to be tolerated downstream, included in the recent-optimized ProjectionAnnotationModel.expandAll method. https://github.com/eclipse-platform/eclipse.platform.ui/issues/2257 --- .../text/source/projection/ProjectionAnnotationModel.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bundles/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionAnnotationModel.java b/bundles/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionAnnotationModel.java index 892d917d301..e82e6011089 100644 --- a/bundles/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionAnnotationModel.java +++ b/bundles/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionAnnotationModel.java @@ -147,6 +147,10 @@ public boolean collapseAll(int offset, int length) { */ protected boolean expandAll(int offset, int length, boolean fireModelChanged) { + if (offset < 0 || length < 0) { + return false; + } + boolean expanding= false; Iterator iterator= getAnnotationIterator(offset, length, true, true);