commit | c26ee1be1fc9a564a23307db33ef2930af66dcfd | [log] [tgz] |
---|---|---|
author | Dirk Steinkamp <dirk.steinkamp@gmx.de> | Wed Mar 09 21:17:02 2022 +0100 |
committer | Mickael Istria <mistria@redhat.com> | Thu Mar 10 11:18:14 2022 -0500 |
tree | d70a6906224b75a643ba00ec7c72228a234352bc | |
parent | 286feeafdadbd9b9c3559b7d56d1da551521c409 [diff] |
Bug 579179 - [Multiple carets] Text component gaining focus only draws first caret Redraw multiple carets if StyledText gains focus Change-Id: I7edecb99682b3c68066495602a3176e2ef497760 Reviewed-on: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/191674 Tested-by: Mickael Istria <mistria@redhat.com> Reviewed-by: Mickael Istria <mistria@redhat.com>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java index a3fed24..527a8f1 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java
@@ -9239,6 +9239,21 @@ this.insideSetEnableCall = false; } } + +@Override +public boolean setFocus() { + boolean focusGained = super.setFocus(); + if (focusGained && hasMultipleCarets()) { + // Multiple carets need to update their drawing. See bug 579179 + setCaretLocations(); + } + return focusGained; +} + +private boolean hasMultipleCarets() { + return carets != null && carets.length > 1; +} + /** * Sets a new font to render text with. * <p>