gespenst API - v0.1.0
    Preparing search index...

    Interface IBuffer

    Represents a terminal buffer.

    interface IBuffer {
        baseY: number;
        cursorX: number;
        cursorY: number;
        length: number;
        type: "normal" | "alternate";
        viewportY: number;
        getLine(y: number): IBufferLine | undefined;
        getNullCell(): IBufferCell;
    }
    Index
    baseY: number

    The line within the buffer where the top of the bottom page is (when fully scrolled down).

    cursorX: number

    The x position of the cursor. This ranges between 0 (left side) and Terminal.cols (after last cell of the row).

    cursorY: number

    The y position of the cursor. This ranges between 0 (when the cursor is at baseY) and Terminal.rows - 1 (when the cursor is on the last row).

    length: number

    The amount of lines in the buffer.

    type: "normal" | "alternate"

    The type of the buffer.

    viewportY: number

    The line within the buffer where the top of the viewport is.

    • Gets a line from the buffer, or undefined if the line index does not exist.

      Note that the result of this function should be used immediately after calling as when the terminal updates it could lead to unexpected behavior.

      Parameters

      • y: number

        The line index to get.

      Returns IBufferLine | undefined

    • Creates an empty cell object suitable as a cell reference in line.getCell(x, cell). Use this to avoid costly recreation of cell objects when dealing with tons of cells.

      Returns IBufferCell