private int getLineAtOffsetStart(int offset) {
      Document document = editor.getDocument();
      if (offset == 0) {
        return 0;
      }
      int lineNumber = editor.offsetToLogicalPosition(offset).line;
      return document.getLineStartOffset(lineNumber);
    }
private int getLineAtOffsetStart(int offset)