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<[string, number, string]>;
19 * Create a new Buffer.
20 * @param {Terminal} terminal - The terminal the Buffer will belong to
21 * @param {number} ydisp - The scroll position of the Buffer in the viewport
22 * @param {number} ybase - The scroll position of the y cursor (ybase + y = the y position within the Buffer)
23 * @param {number} y - The cursor's y position after ybase
24 * @param {number} x - The cursor's x position after ybase
27 private terminal: ITerminal,
28 public ydisp: number = 0,
29 public ybase: number = 0,
32 public scrollBottom: number = 0,
33 public scrollTop: number = 0,
34 public tabs: any = {},
36 this.lines = new CircularList<[string, number, string]>(this.terminal.scrollback);
37 this.scrollBottom = this.terminal.rows - 1;