String (@Nullable Editor editor) { if (editor == null) return null; String selectedText = editor.getSelectionModel().getSelectedText(); if (selectedText == null && Registry.is("ide.find.select.word.at.caret")) { selectedText = getWordAtCaret(editor, true); } return selectedText; }