boolean (@NotNull PsiFile file, @NotNull Editor editor, CharSequence documentText, int caretOffset, EnterBetweenBracesDelegate helper) { int prevCharOffset = CharArrayUtil.shiftBackward(documentText, caretOffset - 1, " \t"); int nextCharOffset = CharArrayUtil.shiftForward(documentText, caretOffset, " \t"); return isValidOffset(prevCharOffset, documentText) && isValidOffset(nextCharOffset, documentText) && helper.isBracePair(documentText.charAt(prevCharOffset), documentText.charAt(nextCharOffset)) && !helper.bracesAreInTheSameElement(file, editor, prevCharOffset, nextCharOffset); }