From 2c63592dd62e2f60b6e72f516b16b4e98fb1f4ce Mon Sep 17 00:00:00 2001 From: Jonah Graham Date: Fri, 14 May 2021 16:33:31 -0400 Subject: [PATCH] Bug 573546: Clear old selection in hover on annotation ruler The select can be called twice when the expansion first opens, so clear out the old selection before processing the new one. If this isn't done, the oldStyles gets set to the highlighted version on the second call, which prevents deselect from removing the highlight. Change-Id: Ibc8ae45d4164d380b7946cd492c29f33c9fac981 --- .../ui/text/c/hover/AnnotationExpansionControl.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/AnnotationExpansionControl.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/AnnotationExpansionControl.java index fd075145ab5..49e2a35d93a 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/AnnotationExpansionControl.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/AnnotationExpansionControl.java @@ -110,6 +110,12 @@ public class AnnotationExpansionControl implements IInformationControl, IInforma StyleRange[] oldStyles; public void selected() { + if (fSelection != null) { + // We can get two selection events back to back because of + // code in org.eclipse.cdt.internal.ui.text.c.hover.AnnotationExpansionControl.setVisible(boolean) + // which forces a select on first open + deselect(); + } Display disp = fShell.getDisplay(); canvas.setCursor(getHandCursor(disp)); // TODO: shade - for now: set grey background