Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10912,19 +10912,18 @@ void updateSelection(int startOffset, int replacedLength, int newLength) {
* @noreference This method is not intended to be referenced by clients.
*/
public static void updateAndRefreshCarets(StyledText styledText, Consumer<Caret> caretUpdater) {
Set<Caret> caretSet = new HashSet<>();
caretSet.add(styledText.getCaret());
styledText.updateCaretVisibility();
styledText.setCaretLocations();
Set<Caret> caretSet = new LinkedHashSet<>();
caretSet.add(styledText.defaultCaret);
caretSet.add(styledText.getCaret());
if (styledText.carets != null) {
for (Caret caret : styledText.carets) {
caretSet.add(caret);
}
}
caretSet.stream().filter(Objects::nonNull).forEach(caretUpdater);

styledText.updateCaretVisibility();
styledText.setCaretLocations();

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,8 @@ private static void handleStyledTextDPIChange(Widget widget, int newZoom, float
if (!(widget instanceof StyledText styledText)) {
return;
}


StyledText.updateAndRefreshCarets(styledText, caretToRefresh -> {
DPIZoomChangeRegistry.applyChange(caretToRefresh, newZoom, scalingFactor);
Caret.win32_setHeight(caretToRefresh, styledText.getLineHeight());
});
}
private static void handleCComboDPIChange(Widget widget, int newZoom, float scalingFactor) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -658,29 +658,6 @@ public void setVisible (boolean visible) {
}
}

/**
* <b>IMPORTANT:</b> This method is not part of the public
* API for Image. It is marked public only so that it
* can be shared within the packages provided by SWT. It is not
* available on all platforms, and should never be called from
* application code.
*
* Sets the height o the caret in points.
*
* @param caret the caret to set the height of
* @param height the height of caret to be set in points.
*
* @noreference This method is not intended to be referenced by clients.
*/
public static void win32_setHeight(Caret caret, int height) {
caret.checkWidget();
if(caret.height != height) {
caret.height = height;
caret.resized = true;
}
if(caret.isVisible && caret.hasFocus()) caret.resize();
}

private static void handleDPIChange(Widget widget, int newZoom, float scalingFactor) {
if (!(widget instanceof Caret caret)) {
return;
Expand All @@ -694,6 +671,7 @@ private static void handleDPIChange(Widget widget, int newZoom, float scalingFac
if (caret.font != null) {
caret.setFont(caret.font);
}
if (caret.isVisible && caret.hasFocus ()) caret.resize();
}
}

Loading