mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-14 18:05:27 +07:00
[ui] fix selection when editor is not fully initialized
related to IDEA-335018 and needed for WI-27593 GitOrigin-RevId: b531e27b144c547b7e97d8f5168c137e2f1c3221
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b1c0963942
commit
89626af21e
@@ -120,11 +120,10 @@ public class NameSuggestionsField extends JPanel {
|
||||
|
||||
public void select(final int start, final int end) {
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
Editor editor = getEditor();
|
||||
if (editor == null) return;
|
||||
editor.getSelectionModel().setSelection(start, end);
|
||||
editor.getCaretModel().moveToOffset(end);
|
||||
|
||||
EditorTextField textField = getEditorTextField();
|
||||
if (textField == null) return;
|
||||
textField.select(TextRange.create(start, end));
|
||||
textField.setCaretPosition(end);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user