int (@NotNull RangeMarker caretRangeMarker, int offset) { if (caretRangeMarker.isValid()) { if (caretRangeMarker.getStartOffset() <= offset && caretRangeMarker.getEndOffset() >= offset) { return offset; } return caretRangeMarker.getEndOffset(); } return offset; }