cel-tui
    Preparing search index...

    Class CellBuffer

    A 2D grid of styled terminal cells.

    The cell buffer is the core rendering target. The layout engine computes rects, painting writes styled cells into those rects, and the diff algorithm compares the current buffer against the previous one to produce minimal terminal updates.

    Empty cells (matching EMPTY_CELL) are considered transparent for layer compositing — higher layers overwrite lower layers only where they have non-empty content.

    Index

    Constructors

    Accessors

    Methods

    Constructors

    • Create a new cell buffer filled with empty cells.

      Parameters

      • width: number

        Buffer width in columns.

      • height: number

        Buffer height in rows.

      Returns CellBuffer

    Accessors

    Methods

    • Compare this buffer against another and return positions that differ. Used for differential rendering — only changed cells need terminal updates.

      Parameters

      Returns { x: number; y: number }[]

      Array of { x, y } positions where cells differ.

    • Fill a rectangular region with a cell value. Coordinates are clipped to buffer bounds.

      Parameters

      • x: number

        Left column (inclusive).

      • y: number

        Top row (inclusive).

      • w: number

        Width in columns.

      • h: number

        Height in rows.

      • cell: Cell

        Cell value to fill with.

      Returns void

    • Check if the cell at (x, y) is empty (transparent). A cell is empty if it matches EMPTY_CELL exactly.

      Parameters

      • x: number
      • y: number

      Returns boolean

    • Resize the buffer. Existing content within the new bounds is preserved. New cells are initialized to EMPTY_CELL.

      Parameters

      • width: number

        New width in columns.

      • height: number

        New height in rows.

      Returns void

    • Set the cell at (x, y). Out-of-bounds writes are silently ignored.

      Parameters

      • x: number
      • y: number
      • cell: Cell

      Returns void