int (@NotNull FileAnnotation fileAnnotation, String @NotNull [] contentsLines, final int actualLine) { final VcsRevisionNumber revision = fileAnnotation.getLineRevisionNumber(actualLine); if (revision == null) return actualLine; if (!StringUtil.isEmptyOrSpaces(contentsLines[actualLine])) return actualLine; int upperBound = Math.min(actualLine + ourVicinity, contentsLines.length); for (int i = actualLine + 1; i < upperBound; i++) { if (revision.equals(fileAnnotation.getLineRevisionNumber(i)) && !StringUtil.isEmptyOrSpaces(contentsLines[i])) { return i; } } int lowerBound = Math.max(actualLine - ourVicinity, 0); for (int i = actualLine - 1; i >= lowerBound; --i) { if (revision.equals(fileAnnotation.getLineRevisionNumber(i)) && !StringUtil.isEmptyOrSpaces(contentsLines[i])) { return i; } } return actualLine; }