boolean (@NotNull Document document, int offset) { CharSequence text = document.getImmutableCharSequence(); return offset >= 0 && offset + 1 < text.length() && Character.isHighSurrogate(text.charAt(offset)) && Character.isLowSurrogate(text.charAt(offset + 1)); }