int () { int startOffset = getStartOffset(); return switch (getTargetArea()) { case EXACT_RANGE -> startOffset; case LINES_IN_RANGE -> { Document document = myModel.getDocument(); int textLength = document.getTextLength(); if (startOffset >= textLength) yield textLength; yield document.getLineStartOffset(document.getLineNumber(startOffset)); } }; }