public static int lineToY(@NotNull Editor editor, int line, boolean lineStart, boolean includeInlays) {
    if (line < 0) return 0;

    Document document = editor.getDocument();
    if (line >= getLineCount(document)) {
      int y = editor.logicalPositionToXY(editor.offsetToLogicalPosition(document.getTextLength())).y;
      int tailLines = line - getLineCount(document) + (lineStart ? 0 : 1);
      return y + editor.getLineHeight() * tailLines;
    }

    if (lineStart) {
      int visualLine = editor.offsetToVisualPosition(document.getLineStartOffset(line), false, false).line;
      int inlay = includeInlays ? EditorUtil.getInlaysHeight(editor, visualLine, true) : 0;
      return editor.visualLineToY(visualLine) - inlay;
    }
    else {
      int visualLine = editor.offsetToVisualPosition(document.getLineEndOffset(line), true, true).line;
      int inlay = includeInlays ? EditorUtil.getInlaysHeight(editor, visualLine, false) : 0;
      return editor.visualLineToY(visualLine) + editor.getLineHeight() + inlay;
    }
  }
public static int lineToY(@NotNull Editor editor, int line, boolean lineStart, boolean includeInlays)