public static int lineToOffset(@NotNull Editor editor, int line) {
    Document document = editor.getDocument();
    return line == DiffUtil.getLineCount(document) ? document.getTextLength() : document.getLineStartOffset(line);
  }
public static int lineToOffset(@NotNull Editor editor, int line)