From 220ef94e1256ec22c0d4f82fb67b6ee39c0c3782 Mon Sep 17 00:00:00 2001 From: arunjose696 Date: Thu, 11 Dec 2025 11:37:18 +0100 Subject: [PATCH] Guard clipping to avoid resize artifacts in tree viewer Setting the clipping region temporarily to the textBounds was originally added (https://bugs.eclipse.org/bugs/show_bug.cgi?id=291245 comment 25) to prevent images from being overdrawn when implementting RIGHT or CENTER column alignment support in StyledCellLabelProvider. However, enabling clipping causes artifact lines during tree resizing, as a temporary workaround the clipping call is now guarded and applied only in those alignment cases to avoid issues with resizing of columns. --- .../src/org/eclipse/jface/viewers/StyledCellLabelProvider.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/StyledCellLabelProvider.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/StyledCellLabelProvider.java index dc37a92cfff..41f6f932090 100644 --- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/StyledCellLabelProvider.java +++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/StyledCellLabelProvider.java @@ -389,7 +389,7 @@ protected void paint(Event event, Object element) { int y = textBounds.y + Math.max(0, (textBounds.height - layoutBounds.height) / 2); - if (gc.isClipped()) { + if (gc.isClipped() && ((style & SWT.RIGHT) != 0 || (style & SWT.CENTER) != 0)) { Rectangle saveClipping = gc.getClipping(); gc.setClipping(textBounds); textLayout.draw(gc, x, y);