Skip to content

Commit f845658

Browse files
Process DPI change only once per caret
using Set to collect all the carets needed to be updated and then calling the callback method to execute the dpi change handler
1 parent 536fea8 commit f845658

File tree

1 file changed

+4
-5
lines changed
  • bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom

1 file changed

+4
-5
lines changed

bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10876,11 +10876,10 @@ void updateSelection(int startOffset, int replacedLength, int newLength) {
1087610876
* @noreference This method is not intended to be referenced by clients.
1087710877
*/
1087810878
public static void updateAndRefreshCarets(StyledText styledText, Consumer<Caret> caretUpdater) {
10879-
caretUpdater.accept(styledText.getCaret());
10880-
caretUpdater.accept(styledText.defaultCaret);
10881-
for (Caret caret : styledText.carets) {
10882-
caretUpdater.accept(caret);
10883-
}
10879+
Set<Caret> caretSet = new HashSet<>(Arrays.asList(styledText.getCaret(), styledText.defaultCaret));
10880+
caretSet.addAll(Arrays.asList(styledText.carets));
10881+
caretSet.forEach(caretUpdater::accept);
10882+
1088410883
styledText.updateCaretVisibility();
1088510884
styledText.setCaretLocations();
1088610885

0 commit comments

Comments
 (0)