Skip to content

Commit 0f466b3

Browse files
ShahzaibIbrahimfedejeanne
authored andcommitted
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 10cb37c commit 0f466b3

File tree

1 file changed

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

1 file changed

+6
-3
lines changed

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

+6-3
Original file line numberDiff line numberDiff line change
@@ -10876,11 +10876,14 @@ 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);
10879+
Set<Caret> caretSet = new HashSet<>();
10880+
caretSet.add(styledText.getCaret());
10881+
caretSet.add(styledText.defaultCaret);
1088110882
for (Caret caret : styledText.carets) {
10882-
caretUpdater.accept(caret);
10883+
caretSet.add(caret);
1088310884
}
10885+
caretSet.forEach(caretUpdater);
10886+
1088410887
styledText.updateCaretVisibility();
1088510888
styledText.setCaretLocations();
1088610889

0 commit comments

Comments
 (0)