5 import { ITerminal } from './Interfaces';
6 import { CircularList } from './utils/CircularList';
9 * This class represents a terminal buffer (an internal state of the terminal), where the
10 * following information is stored (in high-level):
11 * - text content of this particular buffer
16 public lines: CircularList<[number, string, number][]>;
18 public savedY: number;
19 public savedX: number;
22 * Create a new Buffer.
23 * @param {Terminal} terminal - The terminal the Buffer will belong to
24 * @param {number} ydisp - The scroll position of the Buffer in the viewport
25 * @param {number} ybase - The scroll position of the y cursor (ybase + y = the y position within the Buffer)
26 * @param {number} y - The cursor's y position after ybase
27 * @param {number} x - The cursor's x position after ybase
30 private terminal: ITerminal,
31 public ydisp: number = 0,
32 public ybase: number = 0,
35 public scrollBottom: number = 0,
36 public scrollTop: number = 0,
37 public tabs: any = {},
39 this.lines = new CircularList<[number, string, number][]>(this.terminal.scrollback);
40 this.scrollBottom = this.terminal.rows - 1;