boolean (@NotNull CharSequence documentText, @NotNull Segment textRange) { if (textRange.getStartOffset() > 0) { char ch = documentText.charAt(textRange.getStartOffset() - 1); if (isWordPartCondition(ch)) { return true; } } if (textRange.getEndOffset() < documentText.length()) { char ch = documentText.charAt(textRange.getEndOffset()); return isWordPartCondition(ch); } return false; }