boolean (@Nullable Caret caret) { return ReadAction.compute(() -> caret != null && caret.hasSelection() && caret.getOffset() >= caret.getSelectionStart() && caret.getOffset() <= caret.getSelectionEnd()); }